SaltwaterC edited this page Oct 14, 2012 · 2 revisions


S3 helper for copying an S3 object from a source location to the current bucket.


s3.copyObject(source, destination, acl, [headers], callback)
  • 'source' - the source S3 Path. This must be an absolute path, containing the bucket name in the path itself. This path uses the path based addressing of the S3 API. For more information about bucket naming and different styles of object addressing, see the Bucket Name document.
  • 'destination' - the destination S3 Path.
  • 'acl' - the S3 Canned ACL.
  • 'headers' - optional argument. 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.

This helper does not re-upload the object. It uses the PUT Object - Copy method via the x-amz-copy-source HTTP header and the x-amz-metadata-directive HTTP header for copying the source metadata.

You need the read privilege for the source object.