-
Notifications
You must be signed in to change notification settings - Fork 32
s3.putFileMultipart()
SaltwaterC edited this page Jan 31, 2012
·
2 revisions
S3 Multipart Upload API helper for uploading a file to S3
s3.putFileMultipart(path, file, cannedAcl, headers, [partSize], callback)
- 'path' - the S3 Path.
- 'file' - path to the file to be uploaded.
- 'cannedAcl' - the S3 Canned ACL.
- 'headers' - an object containing the HTTP headers you may want to pass to the POST request, such as the x-amz-* metadata headers.
- 'partSize' - optional argument for indicating the maximum size of a single upload part, expressed in bytes. If unspecified / invalid / too small, it defaults to 5242880 bytes.
- 'callback' - the callback that is executed when the processing finishes. It has a couple of arguments: error and result.
- If there's an error, the callback receives the error argument as Error instance.
- If the error argument is null, then the response argument contains the same data as s3.completeUpload() or s3.putFile().
If the object is smaller that the minimal part size (5242880 bytes), then this method falls back to s3.putFile().
The file parts are uploaded concurrently. If an upload part fails, then the transfer is retried. With each retry, there's an arithmetic fallback with 500 miliseconds ratio. If a part fails the transfer 10 times, then the multipart upload process is aborted. An Error object is returned. It has a partNumber key, indicating which specific part went over the 10 fails limit.