Gets information about the specified file in the Media Manager.
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 and runs only on the backend and on dashboard pages.
function getFileDescriptor(fileId: string): Promise<FileDescriptor>;
File ID.
You can also pass the files' Wix media URLs. For example, ["wix:image://v1/0abec0_b291a9349a0b4da59067f76287e386fb~mv2.jpg/leon.jpg#originWidth=3024&originHeight=4032"]
.
Learn more in the File and Folder IDs article.
import { files } from "wix-media.v2";
/* Sample fileId value: 'w8ide0_989yy3iic89mi8880kq9jkr9x7nxiz7l~mv2.jpg' */
async function myGetFileDescriptorFunction(fileId) {
try {
const descriptor = await files.getFileDescriptor(fileId);
console.log("Retrieved descriptor:", descriptor);
return descriptor;
} catch (error) {
console.error(error);
// Handle the error
}
}
/* Promise resolves to:
* {
* "_createdDate": "2023-07-23T10:33:00.000Z",
* "_id": "w8ide0_989yy3iic89mi8880kq9jkr9x7nxiz7l~mv2.jpg",
* "_updatedDate": "2023-07-23T10:33:00.000Z",
* "displayName": "example.jpg",
* "hash": "x5bq2o4p8fj68xqt25v49wdnasys04xe",
* "internalTags": [],
* "labels": [],
* "media": {
* "image": {
* "faces": [],
* "image": "wix:image://v1/w8ide0_989yy3iic89mi8880kq9jkr9x7nxiz7l~mv2.jpg/example.jpg"
* }
* },
* "mediaType": "IMAGE",
* "operationStatus": "READY",
* "parentFolderId": "igje5u22nij3qkltzsnol37j3dnthvvh",
* "private": false,
* "siteId": "3ecba886-4267-11ee-be56-0242ac120002",
* "sizeInBytes": "47177",
* "sourceUrl": "https://example.org/filename.jpg",
* "state": "OK",
* "thumbnailUrl": "https://static.wixstatic.com/media/w8ide0_989yy3iic89mi8880kq9jkr9x7nxiz7l~mv2.jpg",
* "url": "https://static.wixstatic.com/media/w8ide0_989yy3iic89mi8880kq9jkr9x7nxiz7l~mv2.jpg"
* }
*/
There is 1 error with this status code.
This method may also return standard errors. Learn more about standard Wix errors.