Copies an existing file to a new path in the same bucket.
The original file path, including the current file name. For example `folder/image.png`.
The new file path, including the new file name. For example `folder/image-copy.png`.
The destination and metadata options.
const { data, error } = await supabase
.storage
.from('avatars')
.copy('public/avatar1.png', 'private/avatar2.png')
const { data, error } = await supabase
.storage
.from('documents')
.copy('source.txt.gz', 'copy.txt.gz', {
copyMetadata: false,
metadata: { contentEncoding: 'gzip' },
})
The source must already contain gzip-encoded bytes. Copying changes metadata only.