How to copy the object from s3 to s3 using node.js

后端 未结 4 886
小蘑菇
小蘑菇 2021-02-19 13:04

I would like to know how to copy the object from s3 to s3 using node.js With the aws s3 command, It could be executed as follows.

s3 cp --recursive s3://xx/yy  s         


        
4条回答
  •  遥遥无期
    2021-02-19 13:37

    Note that encodeURI is required if the filename has special chars

        await S3.copyObject({
            Bucket: bucketName,
            CopySource: encodeURI(`/${sourceBucketName}/${filename}`),
            Key: filename,
        }).promise()
    

提交回复
热议问题