Gets information about the specified files in the Media Manager.
The getFileDescriptors()
function returns a Promise that resolves to an array containing the specified files' descriptors.
Use getFileDescriptor()
to get a single file descriptor.
This function requires elevated permissions and runs only on the backend and on dashboard pages.
function getFileDescriptors(
fileIds: Array<string>,
): Promise<GetFileDescriptorsResponse>;
File IDs.
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 fileIds value:
* [
* 'w8ide0_87051wjiadg6qj2ywxb07vn5snqxxp2q',
* 'w8ide0_mnk3lozhxu0w4f1g5wuusmwqedox2w1p~mv2.jpg',
* 'w8ide0_578uul37zvr7b6d7ji3cbm91rlf5dvjy.zip'
* ]
*/
async function myGetFileDescriptorsFunction(fileIds) {
try {
const descriptors = await files.getFileDescriptors(fileIds);
console.log("Retrieved descriptors:", descriptors);
return descriptors;
} catch (error) {
console.error(error);
// Handle the error
}
}
/* Promise resolves to:
* {
* "files": [
* {
* "_createdDate": "2023-07-23T09:05:12.000Z",
* "_id": "w8ide0_mnk3lozhxu0w4f1g5wuusmwqedox2w1p~mv2.jpg",
* "_updatedDate": "2023-07-23T09:05:12.000Z",
* "displayName": "image1.jpg",
* "hash": "d7ltmbrrmdspiyrw3db29bpi1g8lsacz",
* "internalTags": [],
* "labels": [],
* "media": {
* "image": {
* "faces": [],
* "image": "wix:image://v1/w8ide0_mnk3lozhxu0w4f1g5wuusmwqedox2w1p~mv2.jpg/image1.jpg#originWidth=1000&originHeight=714"
* }
* },
* "mediaType": "IMAGE",
* "operationStatus": "READY",
* "parentFolderId": "media-root",
* "private": false,
* "siteId": "3ecba886-4267-11ee-be56-0242ac120002",
* "sizeInBytes": "112689",
* "sourceUrl": "https://website.org/image1.jpg",
* "state": "OK",
* "thumbnailUrl": "https://static.wixstatic.com/media/w8ide0_mnk3lozhxu0w4f1g5wuusmwqedox2w1p~mv2.jpg",
* "url": "https://static.wixstatic.com/media/w8ide0_mnk3lozhxu0w4f1g5wuusmwqedox2w1p~mv2.jpg"
* },
* {
* "_createdDate": "2023-07-16T08:56:10.000Z",
* "_id": "w8ide0_578uul37zvr7b6d7ji3cbm91rlf5dvjy.zip",
* "_updatedDate": "2023-07-20T07:16:55.000Z",
* "displayName": "pics",
* "hash": "tmk0uafvzzgkddrgwgl6od1h9jsp1j9e",
* "internalTags": [
* "_fileOrigin_uploaded"
* ],
* "labels": [],
* "media": {
* "archive": {
* "_id": "w8ide0_578uul37zvr7b6d7ji3cbm91rlf5dvjy.zip",
* "filename": "riverpics",
* "sizeInBytes": "49546083",
* "url": "https://3ecba886-4267-11ee-be56-0242ac120002.usrfiles.com/archives/w8ide0_578uul37zvr7b6d7ji3cbm91rlf5dvjy.zip"
* }
* },
* "mediaType": "ARCHIVE",
* "operationStatus": "READY",
* "parentFolderId": "media-root",
* "private": false,
* "siteId": "3ecba886-4267-11ee-be56-0242ac120002",
* "sizeInBytes": "49546083",
* "state": "OK",
* "thumbnailUrl": "https://static.wixstatic.com/media/48c4fbc47d7298cd4406936294b4c532.png",
* "url": "https://3ecba886-4267-11ee-be56-0242ac120002.usrfiles.com/archives/w8ide0_578uul37zvr7b6d7ji3cbm91rlf5dvjy.zip"
* },
* {
* "_createdDate": "2023-07-23T12:15:55.000Z",
* "_id": "w8ide0_87051wjiadg6qj2ywxb07vn5snqxxp2q",
* "_updatedDate": "2023-07-23T12:16:14.000Z",
* "displayName": "video1.mp4",
* "hash": "pdrepnjy3cdjq8bt2lzmpdvuc47mm921",
* "internalTags": [],
* "labels": [],
* "media": {
* "video": "wix:video://v1/w8ide0_87051wjiadg6qj2ywxb07vn5snqxxp2q/video1.mp4#posterUri=w8ide0_87051wjiadg6qj2ywxb07vn5snqxxp2qf001.jpg&posterWidth=1280&posterHeight=720"
* },
* "mediaType": "VIDEO",
* "operationStatus": "READY",
* "parentFolderId": "media-root",
* "private": false,
* "siteId": "3ecba886-4267-11ee-be56-0242ac120002",
* "sizeInBytes": "4384468",
* "sourceUrl": "https://cdn.pixabay.com/example.mp4",
* "state": "OK",
* "thumbnailUrl": "https://static.wixstatic.com/media/w8ide0_87051wjiadg6qj2ywxb07vn5snqxxp2qf002.jpg",
* "url": "https://video.wixstatic.com/video/w8ide0_87051wjiadg6qj2ywxb07vn5snqxxp2q/file"
* }
* ]
* }
*/
There is 1 error with this status code.
This method may also return standard errors. Learn more about standard Wix errors.