-
Notifications
You must be signed in to change notification settings - Fork 32
s3.renameObject()
SaltwaterC edited this page Jul 13, 2012
·
5 revisions
S3 helper for renaming / changing the path of an existing S3 object.
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. Before aws2js v0.6.19 it preserves the Content-Type and Cache-Control headers of the original object. aws2js v0.6.19+ preserves all the object metadata due to implementation of more PUT Object - Copy operations.