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.
function getFileUrl(fileUrl: string): Promise<string>;
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.
import { Permissions, webMethod } from "wix-web-module";
import { mediaManager } from "wix-media-backend";
export const getFileUrl = webMethod(Permissions.Anyone, async (fileUrl) => {
return mediaManager.getFileUrl(fileUrl);
});
/* Returns a promise that resolves to:
* https://download-files.wix.com/_api/download/file?downloadToken=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9eyJpc3MiO...
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.