问题
I am trying to achieve s3 multipart upload with pause and resume options. I am using s3-upload-stream
npm package for this.
It works fine until user closes the application. When the user closes the application accidentally it means I have to resume the upload manually, so using I am this method as they mentioned:
var upload = s3Stream.upload(
{
Bucket: "bucket-name",
Key: "key-name",
ACL: "public-read",
StorageClass: "REDUCED_REDUNDANCY",
ContentType: "binary/octet-stream"
},
{
UploadId: "f1j2b47238f12984f71b2o8347f12",
Parts: [
{
ETag: "3k2j3h45t9v8aydgajsda",
PartNumber: 1
},
{
Etag: "kjgsdfg876sd8fgk3j44t",
PartNumber: 2
}
]
});
I am saving this Etag
, partnumber
, UploadId
in database.
But resuming by this way does not work.
I think the parts are already uploaded are also uploading again this way. because after upload the uploaded file size is larger than original file size and also upload file is corrupted and not able to open.
What am I missing?
来源:https://stackoverflow.com/questions/56412356/s3-multipart-upload-with-pause-and-resume-functionality