getFileDescriptor( )
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.
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
File ID.
Returns
Information about the file.
Return Type:
NAME
TYPE
DESCRIPTION
Date and time the file was created.
File ID. Generated when a file is uploaded to the Media Manager.
Date and time the file was updated.
File name as it appears in the Media Manager.
File hash.
Labels assigned to media files that describe and categorize them. Provided by the user, or generated by Google Vision API for images.
Media file content.
Media file type.
Supported values: "IMAGE"
, "VIDEO"
, "AUDIO"
, "DOCUMENT"
, "VECTOR"
, "ARCHIVE"
, "MODEL3D"
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.
ID of the file's parent folder.
Whether the link to the uploaded file is public or private. Private links require a token.
The Wix site ID where the media file is stored.
Size of the uploaded file in bytes.
URL where the file was uploaded from.
State of the file.
Supported values: "OK"
, "DELETED"
URL of the file's thumbnail.
Static URL of the file.
Was this helpful?
1import { files } from 'wix-media.v2';23/* Sample fileId value: 'w8ide0_989yy3iic89mi8880kq9jkr9x7nxiz7l~mv2.jpg' */45async function myGetFileDescriptorFunction(fileId) {6 try {7 const descriptor = await files.getFileDescriptor(fileId);89 console.log('Retrieved descriptor:', descriptor);10 return descriptor;11 } catch (error) {12 console.error(error);13 // Handle the error14 }15}1617/* Promise resolves to:18 * {19 * "_createdDate": "2023-07-23T10:33:00.000Z",20 * "_id": "w8ide0_989yy3iic89mi8880kq9jkr9x7nxiz7l~mv2.jpg",21 * "_updatedDate": "2023-07-23T10:33:00.000Z",22 * "displayName": "example.jpg",23 * "hash": "x5bq2o4p8fj68xqt25v49wdnasys04xe",24 * "internalTags": [],25 * "labels": [],26 * "media": {27 * "image": {28 * "faces": [],29 * "image": "wix:image://v1/w8ide0_989yy3iic89mi8880kq9jkr9x7nxiz7l~mv2.jpg/example.jpg"30 * }31 * },32 * "mediaType": "IMAGE",33 * "operationStatus": "READY",34 * "parentFolderId": "igje5u22nij3qkltzsnol37j3dnthvvh",35 * "private": false,36 * "siteId": "3ecba886-4267-11ee-be56-0242ac120002",37 * "sizeInBytes": "47177",38 * "sourceUrl": "https://example.org/filename.jpg",39 * "state": "OK",40 * "thumbnailUrl": "https://static.wixstatic.com/media/w8ide0_989yy3iic89mi8880kq9jkr9x7nxiz7l~mv2.jpg",41 * "url": "https://static.wixstatic.com/media/w8ide0_989yy3iic89mi8880kq9jkr9x7nxiz7l~mv2.jpg"42 * }43 */
1import { Permissions, webMethod } from 'wix-web-module';2import { files } from 'wix-media.v2';3import { elevate } from 'wix-auth';45// Sample fileId value: 'w8ide0_989yy3iic89mi8880kq9jkr9x7nxiz7l~mv2.jpg'67export const myGetFileDescriptorFunction = webMethod(Permissions.Anyone, async (fileId) => {8 try {9 const elevatedGetFileDescriptor = elevate(files.getFileDescriptor);10 const descriptor = await elevatedGetFileDescriptor(fileId);1112 console.log('Retrieved descriptor:', descriptor);13 return descriptor;14 } catch (error) {15 console.error(error);16 // Handle the error17 }18});1920/* Promise resolves to:21 * {22 * "_createdDate": "2023-07-23T10:33:00.000Z",23 * "_id": "w8ide0_989yy3iic89mi8880kq9jkr9x7nxiz7l~mv2.jpg",24 * "_updatedDate": "2023-07-23T10:33:00.000Z",25 * "displayName": "example.jpg",26 * "hash": "x5bq2o4p8fj68xqt25v49wdnasys04xe",27 * "internalTags": [],28 * "labels": [],29 * "media": {30 * "image": {31 * "faces": [],32 * "image": "wix:image://v1/w8ide0_989yy3iic89mi8880kq9jkr9x7nxiz7l~mv2.jpg/example.jpg"33 * }34 * },35 * "mediaType": "IMAGE",36 * "operationStatus": "READY",37 * "parentFolderId": "igje5u22nij3qkltzsnol37j3dnthvvh",38 * "private": false,39 * "siteId": "3ecba886-4267-11ee-be56-0242ac120002",40 * "sizeInBytes": "47177",41 * "sourceUrl": "https://example.org/filename.jpg",42 * "state": "OK",43 * "thumbnailUrl": "https://static.wixstatic.com/media/w8ide0_989yy3iic89mi8880kq9jkr9x7nxiz7l~mv2.jpg",44 * "url": "https://static.wixstatic.com/media/w8ide0_989yy3iic89mi8880kq9jkr9x7nxiz7l~mv2.jpg"45 * }46 */47