uppy: Aws S3 Multipart Uploader v2 prepareUploadParts can't access file chunk data

I’ve been trying to migrate from Uppy v1 to v2 and realized with the breaking API change from prepareUploadPart to prepareUploadParts some functionality was lost.

In v1 the function would receive a slice of the file representing the data that would be uploaded. This allows me to calculate the md5 hash of the part, which I pass both for creation of the presigned url and as a header as I actually upload the data to S3 for validation.

In v2, I don’t see a good way to access this data. I could always slice the file myself based on which part number I’m preparing, however I also don’t see a good way to be completely sure which chunk size to use for my calculations without copying the internal logic - this appears simple for now, desired chunk size with a minimum size of 5MB, but if the logic were to change I’d have no good way of knowing. I can see looking through the source that the chunks being uploaded are stored in the MultipartUploader class, but again I don’t see a good way of getting to this data without digging into private state.

I propose that the chunk data is passed along to prepareUploadParts as it was before, perhaps as a map of partNumber -> chunk. Alternatively, if there is a public way to access this data that I’m missing I would love to know.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 18 (12 by maintainers)

Most upvoted comments

@kevin-west-10x can you open a new issue that goes into detail about the change and why it makes sense? We are close to releasing Uppy 3.0, which means an opportunity for breaking changes.

Sure, let me take a look and see.