Skip to content

s3.putStreamPart()

SaltwaterC edited this page Jan 30, 2012 · 1 revision

About

S3 Multipart Upload API helper for uploading a part of a multipart upload that originates from a node.js Readable Stream

Reference

s3.putStreamPart(path, partNumber, uploadId, stream, headers, callback)
  • 'path' - the S3 Path.
  • 'partNumber' - the part number, from 1 to 10,000 inclusive. This is an unique identifier for each upload part.
  • 'uploadId' - the uploadId from s3.initUpload().
  • 'stream' - the Readable Stream instance for the upload.
  • 'headers' - an object containing HTTP headers for the transfer. Content-Lenght is mandatory.
  • '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 an object with the following keys: partNumber and ETag. You need this pair for assembling the uploadParts object for s3.completeUpload().

Each part must be at least 5 MiB (5242880 bytes) in size, except the last part. If you fail to obey this rule, s3.completeUpload() fails with a specific error.

The Content-Lenght HTTP header must be passed to the headers argument. This method has the same limitations as s3.putStream() due to the lack of S3 for request chunked transfer.