Can download uploaded images
This commit is contained in:
@ -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()?;
|
||||
|
Reference in New Issue
Block a user