Skip to content
SaltwaterC edited this page Jul 13, 2012 · 5 revisions

About

S3 helper for renaming / changing the path of an existing S3 object.

Reference

s3.renameObject(sourcePath, targetPath, cannedAcl, [headers], callback)
  • 'sourcePath' - the source S3 Path.
  • 'targetPath' - the target S3 Path.
  • 'cannedAcl' - 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. It preserves the Content-Type and Cache-Control headers of the original object.

Clone this wiki locally