The source file storage provider entity
The destination file storage provider entity
The path to the file in the source provider
The path where the file should be saved in the destination provider
Optionaloptions: CopyBetweenProvidersOptionsOptional user context for OAuth providers
A promise that resolves to a CopyBetweenProvidersResult
// Copy a file from Dropbox to Google Drive
const sourceProvider = await entityMgr.FindById('FileStorageProvider', 'dropbox-id');
const destProvider = await entityMgr.FindById('FileStorageProvider', 'gdrive-id');
const result = await copyObjectBetweenProviders(
sourceProvider,
destProvider,
'documents/report.pdf',
'imported/report.pdf',
{
sourceUserContext: { userID: currentUser.ID, contextUser },
destinationUserContext: { userID: currentUser.ID, contextUser }
}
);
if (result.success) {
console.log(`Transferred ${result.bytesTransferred} bytes`);
}
Copies a file from one storage provider to another.
This utility function enables transferring files between different storage providers (e.g., from Dropbox to Google Drive, or from S3 to Azure). The transfer happens server-side, so the file data flows: Source Provider → Server → Destination Provider.