The file storage provider entity containing connection details
The provider key or name of the file to download (use the ProviderKey if it was returned during upload, otherwise use the file Name)
A promise that resolves to the pre-authenticated download URL as a string
// Get a pre-authenticated download URL for a file
const fileStorageProvider = await entityMgr.FindById('FileStorageProvider', 'azure-main');
// Using the file name
const downloadUrl = await createDownloadUrl(fileStorageProvider, 'reports/annual-report.pdf');
// Or using the provider key if returned during upload
const downloadUrl = await createDownloadUrl(fileStorageProvider, file.ProviderKey);
// The download URL can be provided to clients for direct download
console.log(downloadUrl);
Creates a pre-authenticated download URL for a file from the specified file storage provider.
This utility function simplifies the process of generating download URLs by instantiating the appropriate storage provider driver and delegating to its CreatePreAuthDownloadUrl method. The returned URL can be provided directly to clients for downloading the file without requiring additional authentication.