IPWorks Cloud 2020 Node.js Edition

Questions / Feedback?

CopyFile Method

Copies a file.

Syntax

backblazeb2.copyFile(srcFileId, destBucketId, destFileName, [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, data){ }

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

'data' is the value returned by the method.

'err' has 2 properties which hold detailed information:

err.code
err.message

Remarks

This method copies the file version specified by SrcFileId to the bucket specified by DestBucketId with the name DestFileName. The Id of the newly-created file is returned. If DestBucketId is empty, the source file's bucket is used as the destination bucket.

DestFileName is subject to the same restrictions described in the UploadFile method's documentation; refer to it for more information. If a file named DestFileName already exists in the destination bucket, a new version of it is created.

If the SendMetadataOnCopy configuration setting is enabled, and the ContentType property, the Metadata* properties, and/or the ClientModifiedTime configuration setting are non-empty, then their values will be applied to the destination file. Otherwise, the server will copy the source file's content type and metadata to the destination file.

Finally, note that this method can only be used to copy files up to 5GB in size (or, if Range is non-empty, a range of up to 5GB of data from a larger file). To copy more than 5GB of data, start a new multipart upload with StartMultipartUpload, and then use the CopyPart method to copy the desired data in parts.

The currently-authenticated application key must have the writeFiles and (if the source file's bucket kind is allPrivate) readFiles capabilities to call this method successfully, otherwise the server will return an error. Refer to the AccountCapabilities property for more information.

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