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.
function getFileInfo(fileUrl: string): Promise<FileInfo>;
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.
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"
* }
*/
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.