TTLabs / EvaporateJS

Javascript library for browser to S3 multipart resumable uploads
1.82k stars 207 forks source link

Compress chunks during upload #457

Open jis260 opened 4 years ago

jis260 commented 4 years ago

EvaporateJS is a great library and this is not an issue, but a question on how one might implement compression during upload? This would need to avoid loading the entire file into memory and instead perform the compression as part of the file streaming. It would be great if you could provide some pointers on where this could be implemented?

jakubzitny commented 4 years ago

When you work with File objects, the file is preloaded into memory by browser automatically. If you want to compress it before sending it over, you have to do it before initiating the File upload. You take the Blob data from the File, do whatever compression you like, and then send the resulting Blob to the upload process.