Search.../

getFileDescriptors( )

Developer Preview

Gets information about the specified files in the Media Manager.

Description

The getFileDescriptors() function returns a Promise that resolves to an array containing the specified files' descriptors.

Use getFileDescriptor() to get a single file descriptor.

Admin Method

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

Syntax

function getFileDescriptors(fileIds: Array<string>): Promise<GetFileDescriptorsResponse>

getFileDescriptors Parameters

NAME
TYPE
DESCRIPTION
fileIds
Array<
string
>

File IDs.

Returns

Return Type:

Promise<
GetFileDescriptorsResponse
>
NAME
TYPE
DESCRIPTION
files
Array<
FileDescriptor
>

Information about the requested files.

Was this helpful?

Get file descriptors

Copy Code
1import { files } from 'wix-media.v2';
2import { elevate } from 'wix-auth';
3
4/* Sample fileIds value:
5 * [
6 * 'w8ide0_87051wjiadg6qj2ywxb07vn5snqxxp2q',
7 * 'w8ide0_mnk3lozhxu0w4f1g5wuusmwqedox2w1p~mv2.jpg',
8 * 'w8ide0_578uul37zvr7b6d7ji3cbm91rlf5dvjy.zip'
9 * ]
10 */
11
12async function myGetFileDescriptorsFunction(fileIds) {
13 try {
14 const elevatedGetFileDescriptors = elevate(files.getFileDescriptors);
15 const descriptors = await elevatedGetFileDescriptors(fileIds);
16
17 console.log('Retrieved descriptors:', descriptors);
18 return descriptors;
19 } catch (error) {
20 console.error(error);
21 // Handle the error
22 }
23}
24
25/* Promise resolves to:
26 * {
27 * "files": [
28 * {
29 * "_createdDate": "2023-07-23T09:05:12.000Z",
30 * "_id": "w8ide0_mnk3lozhxu0w4f1g5wuusmwqedox2w1p~mv2.jpg",
31 * "_updatedDate": "2023-07-23T09:05:12.000Z",
32 * "displayName": "image1.jpg",
33 * "hash": "d7ltmbrrmdspiyrw3db29bpi1g8lsacz",
34 * "internalTags": [],
35 * "labels": [],
36 * "media": {
37 * "image": {
38 * "faces": [],
39 * "image": "wix:image://v1/w8ide0_mnk3lozhxu0w4f1g5wuusmwqedox2w1p~mv2.jpg/image1.jpg#originWidth=1000&originHeight=714"
40 * }
41 * },
42 * "mediaType": "IMAGE",
43 * "operationStatus": "READY",
44 * "parentFolderId": "media-root",
45 * "private": false,
46 * "siteId": "3ecba886-4267-11ee-be56-0242ac120002",
47 * "sizeInBytes": "112689",
48 * "sourceUrl": "https://website.org/image1.jpg",
49 * "state": "OK",
50 * "thumbnailUrl": "https://static.wixstatic.com/media/w8ide0_mnk3lozhxu0w4f1g5wuusmwqedox2w1p~mv2.jpg",
51 * "url": "https://static.wixstatic.com/media/w8ide0_mnk3lozhxu0w4f1g5wuusmwqedox2w1p~mv2.jpg"
52 * },
53 * {
54 * "_createdDate": "2023-07-16T08:56:10.000Z",
55 * "_id": "w8ide0_578uul37zvr7b6d7ji3cbm91rlf5dvjy.zip",
56 * "_updatedDate": "2023-07-20T07:16:55.000Z",
57 * "displayName": "pics",
58 * "hash": "tmk0uafvzzgkddrgwgl6od1h9jsp1j9e",
59 * "internalTags": [
60 * "_fileOrigin_uploaded"
61 * ],
62 * "labels": [],
63 * "media": {
64 * "archive": {
65 * "_id": "w8ide0_578uul37zvr7b6d7ji3cbm91rlf5dvjy.zip",
66 * "filename": "riverpics",
67 * "sizeInBytes": "49546083",
68 * "url": "https://3ecba886-4267-11ee-be56-0242ac120002.usrfiles.com/archives/w8ide0_578uul37zvr7b6d7ji3cbm91rlf5dvjy.zip"
69 * }
70 * },
71 * "mediaType": "ARCHIVE",
72 * "operationStatus": "READY",
73 * "parentFolderId": "media-root",
74 * "private": false,
75 * "siteId": "3ecba886-4267-11ee-be56-0242ac120002",
76 * "sizeInBytes": "49546083",
77 * "state": "OK",
78 * "thumbnailUrl": "https://static.wixstatic.com/media/48c4fbc47d7298cd4406936294b4c532.png",
79 * "url": "https://3ecba886-4267-11ee-be56-0242ac120002.usrfiles.com/archives/w8ide0_578uul37zvr7b6d7ji3cbm91rlf5dvjy.zip"
80 * },
81 * {
82 * "_createdDate": "2023-07-23T12:15:55.000Z",
83 * "_id": "w8ide0_87051wjiadg6qj2ywxb07vn5snqxxp2q",
84 * "_updatedDate": "2023-07-23T12:16:14.000Z",
85 * "displayName": "video1.mp4",
86 * "hash": "pdrepnjy3cdjq8bt2lzmpdvuc47mm921",
87 * "internalTags": [],
88 * "labels": [],
89 * "media": {
90 * "video": "wix:video://v1/w8ide0_87051wjiadg6qj2ywxb07vn5snqxxp2q/video1.mp4#posterUri=w8ide0_87051wjiadg6qj2ywxb07vn5snqxxp2qf001.jpg&posterWidth=1280&posterHeight=720"
91 * },
92 * "mediaType": "VIDEO",
93 * "operationStatus": "READY",
94 * "parentFolderId": "media-root",
95 * "private": false,
96 * "siteId": "3ecba886-4267-11ee-be56-0242ac120002",
97 * "sizeInBytes": "4384468",
98 * "sourceUrl": "https://cdn.pixabay.com/example.mp4",
99 * "state": "OK",
100 * "thumbnailUrl": "https://static.wixstatic.com/media/w8ide0_87051wjiadg6qj2ywxb07vn5snqxxp2qf002.jpg",
101 * "url": "https://video.wixstatic.com/video/w8ide0_87051wjiadg6qj2ywxb07vn5snqxxp2q/file"
102 * }
103 * ]
104 * }
105 */