Class: AWS.S3.ManagedUpload
- Inherits:
-
Object
- Object
- AWS.S3.ManagedUpload
- Defined in:
- lib/s3/managed_upload.js
Overview
The managed uploader allows for easy and efficient uploading of buffers, blobs, or streams, using a configurable amount of concurrency to perform multipart uploads where possible. This abstraction also enables uploading streams of unknown size due to the use of multipart uploads.
To construct a managed upload object, see the constructor() function.
Tracking upload progress
The managed upload object can also track progress by attaching an 'httpUploadProgress' listener to the upload manager. This event is similar to AWS.Request~httpUploadProgress but groups all concurrent upload progress into a single event. See httpUploadProgress for more information.
Handling Multipart Cleanup
By default, this class will automatically clean up any multipart uploads
when an individual part upload fails. This behavior can be disabled in order
to manually handle failures by setting the leavePartsOnError
configuration
option to true
when initializing the upload object.
Constructor Summary collapse
-
new AWS.S3.ManagedUpload(options) ⇒ void
constructor
Creates a managed upload object with a set of configuration options.
Event Summary collapse
-
'httpUploadProgress'
function (progress)
Triggered when the uploader has uploaded more data.
Property Summary collapse
-
maxTotalParts ⇒ Number
static
readonly
-
minPartSize ⇒ Number
static
readonly
The minimum number of bytes for an individual part upload.
Method Summary collapse
-
abort() ⇒ void
Aborts a managed upload, including all concurrent upload requests.
-
promise() ⇒ Promise
Returns a 'thenable' promise.
-
send(callback) ⇒ void
Initiates the managed upload for the payload.
Constructor Details
new AWS.S3.ManagedUpload(options) ⇒ void
A "Body" parameter is required to be set prior to calling send().
In Node.js, sending "Body" as object-mode stream may result in upload hangs. Using buffer stream is preferable.
ContentMD5 should not be provided when using the managed upload object. Instead, setting "computeChecksums" to true will enable automatic ContentMD5 generation by the managed upload object.
Creates a managed upload object with a set of configuration options.
Event Details
'httpUploadProgress' — function (progress)
The total
property may not be set if the stream being uploaded has
not yet finished chunking. In this case the total
will be undefined
until the total stream size is known.
This event will not be emitted in Node.js 0.8.x.
Triggered when the uploader has uploaded more data.
Property Details
maxTotalParts ⇒ Number (static, readonly)
minPartSize ⇒ Number (static, readonly)
Returns the minimum number of bytes for an individual part upload.
Method Details
abort() ⇒ void
By default, calling this function will cleanup a multipart upload
if one was created. To leave the multipart upload around after aborting
a request, configure leavePartsOnError
to true
in the constructor().
Calling abort() in the browser environment will not abort any requests that are already in flight. If a multipart upload was created, any parts not yet uploaded will not be sent, and the multipart upload will be cleaned up.
Aborts a managed upload, including all concurrent upload requests.
promise() ⇒ Promise
Returns a 'thenable' promise.
Two callbacks can be provided to the then
method on the returned promise.
The first callback will be called if the promise is fulfilled, and the second
callback will be called if the promise is rejected.
send(callback) ⇒ void
Initiates the managed upload for the payload.