IPWorks Cloud 2020 Node.js Edition

Questions / Feedback?

CopyObject Method

Copies an object.

Syntax

googlestorage.copyObject(srcObjectName, destBucket, destObjectName, [callback])

Callback

The 'callback' parameter specifies a function which will be called when the operation completes (or an error is encountered). If the 'callback' parameter is not specified, then the method will block and will not return until the operation completes (or an error is encountered).

The callback for this method is defined as:

function(err){ }

'err' is the error that occurred. If there was no error, then 'err' is 'null'.

'err' has 2 properties which hold detailed information:

err.code
err.message

Remarks

THis method copies the object specified by SrcObjectName (in the bucket currently selected by Bucket) to the object specified by DestObjectName in DestBucket. If DestBucket is empty, the bucket specified by Bucket is used as the destination bucket.

If the VersionId property is non-empty, the specified version of the source object will be used as the copy source. In this case, DestObjectName may be the same as SrcObjectName to "promote" the version, copying its contents back to the base object.

If there are any metadata items present in the Metadata* properties, they will set on the destination object; otherwise, the server will copy any metadata items present on the source object to the destination object.

Notes:

  • Objects may only be copied to buckets that exist within the same region.
  • Objects larger than 5GB cannot be copied using this method. To copy such objects, start a new multipart upload for the destination object using StartMultipartUpload, and then use the CopyPart method to create parts for said multipart upload using the source object's data.

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks Cloud 2020 Node.js Edition - Version 20.0 [Build 8265]