Skip to content

Commit cd87fc3

Browse files
committed
✨ Enhance file upload logic to support different storage clients; improve handling of storage class configuration
1 parent c890949 commit cd87fc3

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/modules/storage/storage.service.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,16 @@ export class StorageService{
3535
const fileName: string = this.getFileName(sum);
3636
this.logger.verbose(`Uploading file ${fileName}`);
3737
let file: BunFile | S3File;
38-
if(this.s3Client)
38+
if(this.s3Client){
3939
file = this.s3Client.file(fileName);
40-
else
40+
await file.write(data, {
41+
// @ts-ignore
42+
storageClass: process.env.S3_STORAGE_CLASS || "STANDARD",
43+
});
44+
}else{
4145
file = Bun.file(fileName);
42-
await file.write(data);
46+
await file.write(data);
47+
}
4348
return sum;
4449
}
4550

0 commit comments

Comments
 (0)