Copy ObjectAdmin Scope
Note: Ensure you have installed the required package to use this SDK method.
Key Terns
| Name | Definition |
|---|---|
| key | The object that is being copied. |
| destination | Will contain the new path name of the object. |
You can use the copyObject() SDK method, to create a copy of the required object in same or different paths of the bucket.
The bucket reference used in the following code snippet is the component instance. The bucket reference used in the following code snippet is the component instance.
Notes:
-
You need to provide the complete object name, along with the path for both key and destination values.
-
For example, if you have file named “kitten.png” in the path pictures/puppy, and you need to copy the file to pictures/kitten path, then:
- source_object value will be ‘pictures/puppy/kitten.png’
- dest_object value will be ‘pictures/kitten/kitten.png’
copy
const res = await bucket.copyObject('sam/out/sample.txt', 'out/sam/sample.txt');
console.log(res);
Example of Expected Response
copy
{
"copy_to": "sam/out/sample.txt",
"key": "out/sam/sample.txt",
"message": "Object copied successfully."
}
Last Updated 2026-07-02 14:51:41 +0530 IST
Yes
No
Send your feedback to us
Skip
Submit