SaltwaterC edited this page Nov 16, 2011 · 1 revision


S3 helper for uploading node.js Buffer objects as S3 objects.


s3.putBuffer(path, buffer, cannedAcl, headers, callback)
  • 'path' - the S3 Path.
  • 'buffer' - a Buffer object containing the S3 object body.
  • 'cannedAcl' - the S3 Canned ACL.
  • 'headers' - an object containing the HTTP headers you may want to pass to the PUT request, such as the x-amz-* metadata headers.
  • '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 response.headers object as returned by the node.js core HTTPS client.

You must specify the Content-Type header if you don't want Amazon S3 to default to binary/octet-stream. mime-magic doesn't support, yet, the possibility to compute MIMEs based onto buffers of information passing through node.js.

The Content-Length and Content-MD5 headers are automatically computed and you may not override them.