You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Related to #32. Applies to uploadPart and uploadFile.
If hash is not passed and data is a stream, the hash can be computed on the fly and appended to the output, while providing the header X-Bz-Content-Sha1: hex_digits_at_end. It would be nice if the client would wrap up this logic itself.
This change is simpler than it seems at first. I wrote the following transform stream that hashes the content as it passes through, then emits the hash before the stream ends. We are using this in production successfully.
Side note: if streams are used, all retrying/redirect-following should be disabled. This is either unsafe since the stream has been consumed, or will likely consume a large amount of memory as the entire request body is buffered in memory in case the request needs to be replayed. We had to pass maxRedirects: 0 to axios or process memory would balloon (we're uploading several-hundred-MB files and this was killing us).
The text was updated successfully, but these errors were encountered:
Related to #32. Applies to
uploadPart
anduploadFile
.If
hash
is not passed anddata
is a stream, the hash can be computed on the fly and appended to the output, while providing the headerX-Bz-Content-Sha1: hex_digits_at_end
. It would be nice if the client would wrap up this logic itself.This change is simpler than it seems at first. I wrote the following transform stream that hashes the content as it passes through, then emits the hash before the stream ends. We are using this in production successfully.
Used simply like (adjust variable names as needed):
Side note: if streams are used, all retrying/redirect-following should be disabled. This is either unsafe since the stream has been consumed, or will likely consume a large amount of memory as the entire request body is buffered in memory in case the request needs to be replayed. We had to pass
maxRedirects: 0
to axios or process memory would balloon (we're uploading several-hundred-MB files and this was killing us).The text was updated successfully, but these errors were encountered: