Can download uploaded images

This commit is contained in:
2023-08-07 14:53:44 +02:00
parent c6148f6562
commit 75438f4ae0
10 changed files with 166 additions and 6 deletions

View File

@ -55,6 +55,13 @@ pub async fn upload_file(path: &str, content: &[u8]) -> anyhow::Result<()> {
Ok(())
}
/// Get a file
pub async fn get_file(path: &str) -> anyhow::Result<Vec<u8>> {
let bucket = AppConfig::get().s3_bucket()?;
Ok(bucket.get_object(path).await?.to_vec())
}
/// Delete a file, if it exists
pub async fn delete_file_if_exists(path: &str) -> anyhow::Result<()> {
let bucket = AppConfig::get().s3_bucket()?;