getFileInfo( )


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.

Method Declaration
Copy
function getFileInfo(fileUrl: string): Promise<FileInfo>;
Method Parameters
fileUrlstringRequired

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.

Returns
Return Type:Promise<FileInfo>
Get a file's information
JavaScript
import { Permissions, webMethod } from "wix-web-module"; import { mediaManager } from "wix-media-backend"; export const getFileInfo = webMethod(Permissions.Anyone, async (fileUrl) => { return mediaManager.getFileInfo(fileUrl); }); /* Returns a promise that resolves to: * { * "fileUrl": "wix:image://v1/f6c0f9_tg439f4475a749e181dd14407fdbd37e~mv2.jpg/original-name.jpg#originWidth=300&originHeight=300", * "hash": "Ew00kXbu4Zt33rzjcWa6Ng==", * "sizeInBytes": 51085, * "mimeType": "image/jpeg", * "mediaType": "image", * "isPrivate": false, * "iconUrl": "wix:image://v1/f6c0f9_tg439f4475a749e181dd14407fdbd37e~mv2.jpg/original-name.jpg#originWidth=300&originHeight=300", * "parentFolderId": "2bf470f5be194b319cdb2accc3278ff9", * "originalFileName": "original-name.jpg", * "sourceUrl": "https://somedomain.com/img/original-name.jpg", * "width": 300, * "height": 300, * "labels": [ * "Blue", * "Butterfly", * "Turquoise" * ], * "opStatus": "READY" * } */
Did this help?

getFileUrl( )


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.

Method Declaration
Copy
function getFileUrl(fileUrl: string): Promise<string>;
Method Parameters
fileUrlstringRequired

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.

Returns
Return Type:Promise<string>
Get a file's URL

This example uses a deprecated function.

JavaScript
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... */
Did this help?

getFolderInfo( )


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.

Method Declaration
Copy
function getFolderInfo(folderId: string): Promise<FolderInfo>;
Method Parameters
folderIdstringRequired

Internal name (unique identifier) which is generated when a folder is created by the Media Manager.

Returns
Return Type:Promise<FolderInfo>
Get a folder's information
JavaScript
import { Permissions, webMethod } from "wix-web-module"; import { mediaManager } from "wix-media-backend"; const folderId = "1bf317e889264736b5acb367415fad8e"; export const myGetFolderInfoFunction = webMethod( Permissions.Anyone, async () => { try { const myFolder = await mediaManager.getFolderInfo(folderId); const folderName = myFolder.folderName; const updatedDate = myFolder._updatedDate; return myFolder; } catch (error) { console.error(error); } }, ); /* Returns a promise that resolves to: * { * "folderId": "1bf317e889264736b5acb367415fad8e", * "folderName": "greatfolder1", * "parentFolderId": "media-root", * "_createdDate": "Sun December 4 2020 14:56:15 GMT+0300", * "_updatedDate": "Wed May 12 2021 14:56:15 GMT+0300" * } */
Did this help?