-
Notifications
You must be signed in to change notification settings - Fork 301
fix for no content-length in header for download #76
Conversation
When using a 3rd party S3 storage service (not AWS), there are instances when the server returns a header without ‘content-length’ specified and instead uses 'transfer-encoding': 'chunked’. This workout around will create a writeable stream to save a file and still emit progress total, but at 99%. When the transfer ends, the progress will add 1 to be complete at 100%
|
added |
|
??? Just checking in on this. No movement. |
|
Hello. I'm sorry for taking so long to get to this. I don't have the development efforts available currently to support anything other than Amazon S3. |
|
Please add tests to prove this does not break normal S3 and works with your 3rd party system |
|
@faceleg it does not break normal S3. i just ran the test |
|
Are there tests to show it works with your 3rd party system? Thanks for letting me know it passes for normal s3 |
tested and works with both s3 and s3-compatible storage Signed-off-by: Kendrick Coleman <kendrickcoleman@gmail.com>
|
i have added an |
|
Thank you for bearing with me. I'm keen to get some CI action for this repo. Have you used http://s3ninja.net? |
fix for no content-length in header for download
|
CI would be nice... no, i have not used s3ninja. glad to see this finally get merged |
|
Thank @andrewrk for kindly agreeing to allow me to help him maintain the repo. And you for allowing me to be really annoying and insist on more tests :P |
When using a 3rd party S3 storage service (not AWS) there are instances when the server returns a header without ‘content-length’. This makes anything specifying
content-lengthindoTheDownloadfunction fail. After troubleshooting, some 3rd party S3 services specifytransfer-encoding: chunked.This workaround will repeat some of the code after verifying that the
content-length == undefined. This will create a writeable stream to save a file, while still emitting progress. Thedownloader.progressTotalwill be thechunk.length, while thedownloader.progressAmountwill bechunk.length -1. This keeps the total below completion(ie 99%). It's impossible to know the complete size because thecontent-lengthis not specified. When the transfer ends, +1 is added todownloader.progressAmountto be complete at 100%.