Search.../

getFileInfo( )

Gets a file's information from the Media Manager by fileUrl.

Description

The getFileInfo() function returns a Promise that resolves to information about the specified file.

Syntax

function getFileInfo(fileUrl: string): FileInfo

getFileInfo 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 - Information about the file.

Return Type:

Promise<FileInfo>
NAME
TYPE
DESCRIPTION
fileName
string

Deprecated. Use the fileUrl property instead.

The fileName property is the internal name (unique identifier) which is generated when a file is uploaded by the Media Manager, returned from the importFile(), or upload() functions. The name is the string located in the file's URL. Click here to learn more. Use this name when calling the getFileInfo(), getFileUrl(), and getVideoPlaybackUrl() functions.

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>]'.

hash
string

File hash.

sizeInBytes
number

Size of the uploaded file in bytes.

mimeType
string

Mime type of the uploaded file.

mediaType
string

Type of the file that was uploaded. One of:

  • "audio"
  • "document"
  • "image"
  • "shape"
  • "video"
isPrivate
boolean

Whether the link to the uploaded file is public or private. Private links require a token to be used.

parentFolderId
string

ID of the file's parent folder.

originalFileName
string

Original name of the uploaded file. This is the display name that appears in the Media Manager.

opStatus
string

Status of the file that was uploaded. One of:

  • "IN-DOWNLOAD-QUEUE"
  • "IN-QUEUE"
  • "READY"
sourceURL
string

URL where the file was uploaded from.

iconUrl
string

URL of the file's icon.

labels
Array<string>

List of labels assigned to the file by the Media Manager.

height
string

Media height.

width
string

Media width.

_createdDate
Date

Date the file was created.

_updatedDate
Date

Date the file was updated.

Was this helpful?

Get a file's information

Copy Code
1import { Permissions, webMethod } from 'wix-web-module';
2import { mediaManager } from 'wix-media-backend';
3
4export const getFileInfo = webMethod(Permissions.Anyone, async (fileUrl) => {
5 return mediaManager.getFileInfo(fileUrl);
6});
7
8/* Returns a promise that resolves to:
9 * {
10 * "fileUrl": "wix:image://v1/f6c0f9_tg439f4475a749e181dd14407fdbd37e~mv2.jpg/original-name.jpg#originWidth=300&originHeight=300",
11 * "hash": "Ew00kXbu4Zt33rzjcWa6Ng==",
12 * "sizeInBytes": 51085,
13 * "mimeType": "image/jpeg",
14 * "mediaType": "image",
15 * "isPrivate": false,
16 * "iconUrl": "wix:image://v1/f6c0f9_tg439f4475a749e181dd14407fdbd37e~mv2.jpg/original-name.jpg#originWidth=300&originHeight=300",
17 * "parentFolderId": "2bf470f5be194b319cdb2accc3278ff9",
18 * "originalFileName": "original-name.jpg",
19 * "sourceUrl": "https://somedomain.com/img/original-name.jpg",
20 * "width": 300,
21 * "height": 300,
22 * "labels": [
23 * "Blue",
24 * "Butterfly",
25 * "Turquoise"
26 * ],
27 * "opStatus": "READY"
28 * }
29 */