Returns a download URL for downloading a folder from the Media Manager.
The downloadFolder()
function returns a Promise that resolves to a download URL
for a Media Manager folder's files and sub-folders.
A compressed file is created and can be downloaded using the download URL. The compressed file can contain up to 1000 files. Sub-folders are included. The name of the top-level folder requested for download isn't included.
Call the wix-location.to()
function with
the returned download URL as the external web address. This opens the Download bar in your browser.
This function provides a permanent URL for downloading a folder.
To get a temporary download URL for a single file, use the getDownloadUrl()
function.
function downloadFolder(folderId: string): Promise<string>;
The ID of the folder to download. You can get the ID with the
folderId
property of the listFolders()
function.
import { Permissions, webMethod } from "wix-web-module";
import { mediaManager } from "wix-media-backend";
/* Sample folderId value:
* '0abec0_bed6f8efb53348379b2011514254e954'
*/
export const myDownloadFolderFunction = webMethod(
Permissions.Anyone,
(folderId) => {
return mediaManager
.downloadFolder(folderId)
.then((downloadUrl) => {
return downloadUrl;
})
.catch((error) => {
console.error(error);
});
},
);
/* Promise resolves to a download URL similar to:
* 'https://archive.wixmp.com/archive/wix/2d8d9ffc016c443387e42abf8e459c66'
*/
Gets a temporary download URL with a token for a specified file in the Media Manager.
The getDownloadUrl()
function returns a Promise that resolves to
a download URL for a specified file in the Media Manager.
Pass the file's URL in the fileUrl
parameter, as returned
in the fileUrl
property of the getFileInfo()
, importFile()
, upload()
, and listFiles()
functions.
When the download URL is clicked, the specified file downloads to your device.
You can use the getDownloadUrl()
function to allow external clients to download a file from the Media Manager to their device.
This function provides a temporary URL for downloading a single file.
If you need permanent download URLs for one or more files, use the downloadFiles()
function.
Notes:
getDownloadUrl()
must be called for each file that you want to download.null
as a placeholder for any unspecified parameters. For example, to specify downloadedFileName
only, call getDownloadUrl(fileUrl, null, downloadedFileName, null)
.
The file's Wix media URL in the following format: 'wix:image://v1//#originWidth=&originHeight=[&watermark=]'
.
The time (in minutes) it takes for the download URL to expire.
Defaults to 600
. Limit is 525600
(1 year).
The downloaded file's name. Defaults to the file's name displayed in the Media Manager.
The redirect URL for when the download URL with a token has expired. Defaults to a 403 Forbidden response page.
When clicked, the URL downloads a file from the Media Manager to your device.
Gets a file's information from the Media Manager by fileUrl
.
The getFileInfo()
function returns a Promise that resolves to information about
the specified file.
The file's Wix media URL in the following format: 'wix:image://v1//#originWidth=&originHeight=[&watermark=]'
.
Note: This replaces the old fileName
parameter. fileName
will continue to work, but we recommend that you use the updated fileUrl
parameter instead.
Deprecated.
This function will continue to work, but a newer version is available. Use the getDownloadUrl
function instead.
Note: The new getDownloadUrl
function contains additional parameters.
Gets a temporary download URL with a token from the Media Manager for a specified file.
The getFileUrl()
function returns a Promise that resolves to
a download URL for the specified file.
Pass a Media Manager file URL in the fileUrl
parameter,
as returned in the fileUrl
property from the getFileInfo()
,
importFile()
, and upload()
functions.
The file's Wix media URL in the following format: 'wix:image://v1//#originWidth=&originHeight=[&watermark=]'
.
Note: This replaces the old fileName
parameter. fileName
will continue to work, but we recommend that you use the updated fileUrl
parameter instead.
This example uses a deprecated function.
Gets a folder's information from the Media Manager by folderId
.
The getFolderInfo()
function returns a Promise that resolves to information about
the specified folder.
The folderId
property is the internal name (unique identifier) which is generated when a folder is created by the Media Manager.
Internal name (unique identifier) which is generated when a folder is created by the Media Manager.