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" * } */
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?