File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3333 "dependencies" : {
3434 "@aws-sdk/client-s3" : " ^3.1013.0" ,
3535 "@aws-sdk/credential-provider-node" : " ^3.972.23" ,
36+ "@aws-sdk/lib-storage" : " ^3.1013.0" ,
3637 "@azure/identity" : " ^4.13.1" ,
3738 "@azure/service-bus" : " ^7.9.5" ,
3839 "@azure/storage-blob" : " ^12.31.0" ,
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import * as os from "node:os";
33import * as path from "node:path" ;
44import * as stream from "node:stream" ;
55import * as S3 from "@aws-sdk/client-s3" ;
6+ import { Upload } from "@aws-sdk/lib-storage" ;
67import * as AzureIden from "@azure/identity" ;
78import { defaultProvider } from "@aws-sdk/credential-provider-node" ;
89import { BlobServiceClient , ContainerClient } from "@azure/storage-blob" ;
@@ -363,14 +364,16 @@ class S3FileStore implements FileStore {
363364 contentType : string ,
364365 localFilepath : string ,
365366 ) {
366- await this . client . send (
367- new S3 . PutObjectCommand ( {
367+ const upload = new Upload ( {
368+ client : this . client ,
369+ params : {
368370 Bucket : this . bucket ,
369371 Key : filepath ,
370372 Body : fs . createReadStream ( localFilepath ) ,
371373 ContentType : contentType ,
372- } ) ,
373- ) ;
374+ } ,
375+ } ) ;
376+ await upload . done ( ) ;
374377 }
375378
376379 async getAsStream ( filepath : string ) : Promise < NodeJS . ReadableStream > {
@@ -391,14 +394,16 @@ class S3FileStore implements FileStore {
391394 contentType : string ,
392395 rs : stream . Readable ,
393396 ) : Promise < void > {
394- await this . client . send (
395- new S3 . PutObjectCommand ( {
397+ const upload = new Upload ( {
398+ client : this . client ,
399+ params : {
396400 Bucket : this . bucket ,
397401 Key : filepath ,
398402 Body : rs ,
399403 ContentType : contentType ,
400- } ) ,
401- ) ;
404+ } ,
405+ } ) ;
406+ await upload . done ( ) ;
402407 }
403408
404409 async getInfo ( filepath : string ) : Promise < FileInfo | null > {
You can’t perform that action at this time.
0 commit comments