The file storage provider entity containing connection details
The key or name of the object's current location (use the ProviderKey if it was returned during upload, otherwise use the file Name)
The key or name for the object's new location
A promise that resolves to a boolean indicating whether the move operation was successful
// Move a file from one location to another
const fileStorageProvider = await entityMgr.FindById('FileStorageProvider', 'azure-main');
// Move a file to a different directory
const success = await moveObject(
fileStorageProvider,
'drafts/report.docx',
'published/final-report.docx'
);
if (success) {
console.log('File successfully moved');
} else {
console.log('Failed to move file');
}
Moves an object from one location to another within the specified file storage provider.
This utility function handles moving files by instantiating the appropriate storage provider driver and delegating to its MoveObject method. It can be used to rename files or move them to different directories within the same storage provider.