Generates a URL for downloading a compressed file containing a specific folder in the Media Manager.
The generateFolderDownloadUrl()
function returns a Promise that resolves to a download URL.
The compressed file can contain sub-folders, and up to 1000 files.
This function requires elevated permissions and runs only on the backend and on dashboard pages.
function generateFolderDownloadUrl(
folderId: string,
): Promise<GenerateFolderDownloadUrlResponse>;
Folder ID.
import { folders } from "wix-media.v2";
async function generateFolderDownloadUrl(folderId) {
try {
const result = await folders.generateFolderDownloadUrl(folderId);
const folderDownloadUrl = result.downloadUrl;
return folderDownloadUrl;
} catch (error) {
console.error(error);
// Handle the error
}
}
/* Promise resolves to:
* {
* "downloadUrl": "https://archive.wixmp.com/archive/wix/b367fe21877e4ef589cde5352a3a04af"
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.