Search.../

getFileUrl( )

Deprecated. This function will continue to work, but a newer version is available. Use the getDownloadUrl function instead.

Description


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.

Syntax

function getFileUrl(fileUrl: string): Promise<string>

getFileUrl Parameters

NAME
TYPE
DESCRIPTION
fileUrl
string

The file's Wix media URL in the following format: 'wix:image://v1/<uri>/<filename>#originWidth=<width>&originHeight=<height>[&watermark=<watermark_manifest_string>]'.

Note: This replaces the old fileName parameter. fileName will continue to work, but we recommend that you use the updated fileUrl parameter instead.

Returns

Fulfilled - The file's download URL.

Return Type:

Promise<string>

Was this helpful?

Get a file's URL

This example uses a deprecated function.

Copy Code
1import { Permissions, webMethod } from 'wix-web-module';
2import { mediaManager } from 'wix-media-backend';
3
4export const getFileUrl = webMethod(Permissions.Anyone, async (fileUrl) => {
5 return mediaManager.getFileUrl(fileUrl);
6});
7
8/* Returns a promise that resolves to:
9 * https://download-files.wix.com/_api/download/file?downloadToken=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9eyJpc3MiO...
10 */