Search.../

getFileDescriptor( )

Developer Preview

Gets information about the specified file in the Media Manager.

Description

The getFileDescriptor() function returns a Promise that resolves to the specified file's descriptor.

Use getFileDescriptors() to get multiple file descriptors at once.

Admin Method

This function requires elevated permissions to run. This function is not universal and runs only on the backend.

Syntax

function getFileDescriptor(fileId: string): Promise<FileDescriptor>

getFileDescriptor Parameters

NAME
TYPE
DESCRIPTION
fileId
string

File ID.

Returns

Information about the file.

Return Type:

Promise<
FileDescriptor
>
NAME
TYPE
DESCRIPTION
_createdDate
Date

Date and time the file was created.

_id
string

File ID. Generated when a file is uploaded to the Media Manager.

_updatedDate
Date

Date and time the file was updated.

displayName
string

File name as it appears in the Media Manager.

hash
string

File hash.

labels
Array<
string
>

Labels assigned to media files that describe and categorize them. Provided by the user, or generated by Google Vision API for images.

media
FileMedia

Media file content.

mediaType
string

Media file type.

Supported values: "IMAGE", "VIDEO", "AUDIO", "DOCUMENT", "VECTOR", "ARCHIVE", "MODEL3D"

operationStatus
string

Status of the file that was uploaded.

Supported values: "FAILED", "READY", "PENDING"

  • FAILED: The file failed to upload, for example, during media post processing.
  • READY: The file uploaded, finished all processing, and is ready for use.
  • PENDING: The file is processing and the URLs are not yet available. This response is returned when importing a file.
parentFolderId
string

ID of the file's parent folder.

private
boolean

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

siteId
string

The Wix site ID where the media file is stored.

sizeInBytes
string

Size of the uploaded file in bytes.

sourceUrl
string

URL where the file was uploaded from.

state
string

State of the file.

Supported values: "OK", "DELETED"

thumbnailUrl
string

URL of the file's thumbnail.

url
string

Static URL of the file.

Was this helpful?

Get a file descriptor

Copy Code
1import { files } from 'wix-media.v2';
2import { elevate } from 'wix-auth';
3
4/* Sample fileId value: 'w8ide0_989yy3iic89mi8880kq9jkr9x7nxiz7l~mv2.jpg' */
5
6async function myGetFileDescriptorFunction(fileId) {
7 try {
8 const elevatedGetFileDescriptor = elevate(files.getFileDescriptor);
9 const descriptor = await elevatedGetFileDescriptor(fileId);
10
11 console.log('Retrieved descriptor:', descriptor);
12 return descriptor;
13 } catch (error) {
14 console.error(error);
15 // Handle the error
16 }
17}
18
19/* Promise resolves to:
20 * {
21 * "_createdDate": "2023-07-23T10:33:00.000Z",
22 * "_id": "w8ide0_989yy3iic89mi8880kq9jkr9x7nxiz7l~mv2.jpg",
23 * "_updatedDate": "2023-07-23T10:33:00.000Z",
24 * "displayName": "example.jpg",
25 * "hash": "x5bq2o4p8fj68xqt25v49wdnasys04xe",
26 * "internalTags": [],
27 * "labels": [],
28 * "media": {
29 * "image": {
30 * "faces": [],
31 * "image": "wix:image://v1/w8ide0_989yy3iic89mi8880kq9jkr9x7nxiz7l~mv2.jpg/example.jpg"
32 * }
33 * },
34 * "mediaType": "IMAGE",
35 * "operationStatus": "READY",
36 * "parentFolderId": "igje5u22nij3qkltzsnol37j3dnthvvh",
37 * "private": false,
38 * "siteId": "3ecba886-4267-11ee-be56-0242ac120002",
39 * "sizeInBytes": "47177",
40 * "sourceUrl": "https://example.org/filename.jpg",
41 * "state": "OK",
42 * "thumbnailUrl": "https://static.wixstatic.com/media/w8ide0_989yy3iic89mi8880kq9jkr9x7nxiz7l~mv2.jpg",
43 * "url": "https://static.wixstatic.com/media/w8ide0_989yy3iic89mi8880kq9jkr9x7nxiz7l~mv2.jpg"
44 * }
45 */