-
Notifications
You must be signed in to change notification settings - Fork 1.5k
S3 Managed Upload Support #427
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Usage: ```js var fs = require('fs'); var zlib = require('zlib'); var body = fs.createReadStream('bigfile').pipe(zlib.createGzip()); var s3obj = new AWS.S3({params: {Bucket: 'myBucket', Key: 'myKey'}}); s3obj.upload(). on('httpUploadProgress', function(evt) { console.log(evt); }). send({Body: body}, function(err, data) { console.log(err, data) }); ``` Or via the ManagedUpload class: ```js var fs = require('fs'); var zlib = require('zlib'); var params = { Bucket: 'myBucket', Key: 'myKey', Body: fs.createReadStream('bigfile').pipe(zlib.createGzip()) } var upload = new AWS.S3.ManagedUpload(); upload.on('httpUploadProgress', function(evt) { console.log(evt); }); upload.send(params, function(err, data) { console.log(err, data) }); ``` References #135
otherwise, setting `Location` on `data` will raise.
pass error to callback early in finishSinglePart
API has changed to: AWS.S3.upload(params, [options], [callback]) If no callback is supplied, the operation returns an object that can call `.send([callback])`. Example: s3.upload({Body: body}, {queueSize: 10}, function(err, data) { console.log(err, data); }); // or s3.upload({Body: body}, {queueSize: 10}).send(callback); The `options` parameter can be omitted.
lsegal
added a commit
that referenced
this pull request
Dec 10, 2014
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull requests adds support for
AWS.S3.upload()
, which allows uploading of large or arbitrarily sized buffer/stream objects in parallel parts (when possible). This PR also adds theAWS.S3.ManagedUpload
abstraction, which is the underlying object that manages the uploads.This abstraction works by performing a multipart upload when there is more than 5MB of buffered data to upload.
Example usage:
Or via the ManagedUpload class directly:
It is possible to configure concurrency with the
queueSize
configuration option:By default this abstraction will cleanup a multipart upload if an error occurs on any part, though it is possible to set
leavePartsOnError
to true to avoid cleanup and handle this manually.