s3.putFile()

SaltwaterC edited this page Nov 16, 2011 · 1 revision

About

S3 helper for uploading a file from your local storage.

Reference

s3.putFile(path, file, cannedAcl, headers, callback)
  • 'path' - the S3 Path.
  • 'file' - the path to the file you want to upload. It may be a relative path that is resolved to an absolute path by path.resolve().
  • '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 may add the Content-Type header in order to indicate the MIME type of the resource. If this header is blank, then the library uses mime-magic to compute the MIME type.

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