Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resuming in a later session results in corrupted uploads #45

Open
mikew opened this issue Nov 28, 2016 · 1 comment
Open

Resuming in a later session results in corrupted uploads #45

mikew opened this issue Nov 28, 2016 · 1 comment

Comments

@mikew
Copy link

mikew commented Nov 28, 2016

How is one supposed to track parts as they are uploaded? Our app needs to upload giant files, and we need to handle poor internet connections. So there's not always a chance that the upload will ever send out a pause event.

Currently we are tracking parts from the part event and adding them to an array. When I use the UploadId and Parts from a previous session, s3-upload-stream always starts from the beginning and ends up uploading too much, corrupting the file.

Here's how we're calling s3-upload-stream

const destinationDetails = {
  // ...
}

const sessionDetails = {
  "UploadId": "SECRET_UPLOAD_ID",
  "Parts": [
    {
      "ETag": "\"ee72b288175a979f6475b7241dcb9913\"",
      "PartNumber": 1
    },
    {
      "ETag": "\"e33260ba6180f1294592f25985c0109e\"",
      "PartNumber": 2
    }
  ]
}

const uploader = s3Stream.upload(destinationDetails, sessionDetails)

uploader.on('part', details => {
  console.log(details)
})

And if we see what the part event logs:

{
  "ETag": "\"ee72b288175a979f6475b7241dcb9913\"",
  "PartNumber": 3
}

It's the exact same ETag we passed in via sessionDetails, and it gets uploaded as another part, which corrupts the file.

@Rambarani
Copy link

Did you find answer ?? . i am facing the same issue , can't get answer , can you please help me ??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants