File tree Expand file tree Collapse file tree 2 files changed +12
-11
lines changed Expand file tree Collapse file tree 2 files changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ export class MinioService implements OnModuleInit {
6464 const s3Region = configService . get < string > ( 'OBB_S3_REGION' , 'us-east-1' ) ;
6565 const forcePathStyle =
6666 configService . get < string > ( 'OBB_S3_FORCE_PATH_STYLE' , 'false' ) === 'true' ;
67+
6768 this . s3Client = new S3Client ( {
6869 region : s3Region ,
6970 credentials : {
@@ -114,34 +115,34 @@ export class MinioService implements OnModuleInit {
114115 }
115116
116117 async putObject (
117- objectName : string ,
118+ key : string ,
118119 buffer : Buffer ,
119- mimetype ?: string ,
120+ contentType ?: string ,
120121 metadata ?: Record < string , string > ,
121- ) {
122+ ) : Promise < void > {
122123 const command = new PutObjectCommand ( {
123124 Bucket : this . bucket ,
124- Key : objectName ,
125+ Key : key ,
125126 Body : buffer ,
126- ContentType : mimetype ,
127+ ContentType : contentType ,
127128 Metadata : metadata ,
128129 } ) ;
129- return await this . s3Client . send ( command ) ;
130+ await this . s3Client . send ( command ) ;
130131 }
131132
132- async getObject ( objectName : string ) : Promise < Readable > {
133+ async getObject ( key : string ) : Promise < Readable > {
133134 const command = new GetObjectCommand ( {
134135 Bucket : this . bucket ,
135- Key : objectName ,
136+ Key : key ,
136137 } ) ;
137138 const response = await this . s3Client . send ( command ) ;
138139 return response . Body as Readable ;
139140 }
140141
141- async removeObject ( objectName : string ) {
142+ async deleteObject ( key : string ) {
142143 const command = new DeleteObjectCommand ( {
143144 Bucket : this . bucket ,
144- Key : objectName ,
145+ Key : key ,
145146 } ) ;
146147 return await this . s3Client . send ( command ) ;
147148 }
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ export class ChunkManagerService {
7575
7676 await Promise . all (
7777 objectsToRemove . map ( ( objectName ) =>
78- this . minioService . removeObject ( objectName ) . catch ( ( error ) => {
78+ this . minioService . deleteObject ( objectName ) . catch ( ( error ) => {
7979 this . logger . warn ( `Failed to remove object ${ objectName } :` , error ) ;
8080 } ) ,
8181 ) ,
You can’t perform that action at this time.
0 commit comments