Search.../

onFileDescriptorFileReady( )

Developer Preview

Triggered when a file is ready to be used, after any post-upload processing.

Description

This event is also triggered when a file is restored from the Media Manager's trash bin.

Syntax

function wixMediaSiteMedia_onFileDescriptorFileReady(event: FileDescriptorFileReady): void

onFileDescriptorFileReady Parameters

NAME
TYPE
DESCRIPTION
event
Optional
FileDescriptorFileReady

Information about the file and metadata for the event.

Returns

This function does not return anything.

Return Type:

void

Was this helpful?

An event that triggers when a file is ready to be used

Copy Code
1// Place this code in the events.js file
2// of your site's Backend section.
3// Add the file if it doesn't exist.
4
5export function wixMediaSiteMedia_onFileDescriptorFileReady(event) {
6 const displayName = event.data.file.displayName;
7 const parentFolderId = event.data.parentFolderId;
8 const eventTime = event.metadata.eventTime;
9
10 console.log(`${displayName}, located in the parent folder with ID ${parentFolderId}, is ready to be used. Completion of post-upload processing was at ${eventTime}.`)
11}
12
13/* Full event object:
14 * {
15 * "data": {
16 * "externalInfo": {},
17 * "file": {
18 * "_createdDate": "2023-08-09T08:45:49.000Z",
19 * "_id": "d4dde1_e26da94b5cb440649ede0c433425449c~mv2.jpg",
20 * "_updatedDate": "2023-08-09T08:45:49.000Z",
21 * "displayName": "mountains.jpg",
22 * "hash": "800fae3e0cb7908518a391c25864436c",
23 * "labels": [
24 * "mountainous range",
25 * "mountain range",
26 * "mountain peak",
27 * "mountains",
28 * "snow capped mountains",
29 * "mountainous landscape"
30 * ],
31 * "media": {
32 * "image": {
33 * "colors": {
34 * "palette": [
35 * {
36 * "rgb": {
37 * "b": 47,
38 * "g": 36,
39 * "r": 31
40 * }
41 * },
42 * {
43 * "rgb": {
44 * "b": 155,
45 * "g": 153,
46 * "r": 195
47 * }
48 * },
49 * {
50 * "rgb": {
51 * "b": 141,
52 * "g": 123,
53 * "r": 138
54 * }
55 * },
56 * {
57 * "rgb": {
58 * "b": 177,
59 * "g": 161,
60 * "r": 190
61 * }
62 * },
63 * {
64 * "rgb": {
65 * "b": 179,
66 * "g": 178,
67 * "r": 217
68 * }
69 * },
70 * {
71 * "rgb": {
72 * "b": 160,
73 * "g": 176,
74 * "r": 229
75 * }
76 * },
77 * {
78 * "rgb": {
79 * "b": 176,
80 * "g": 151,
81 * "r": 162
82 * }
83 * },
84 * {
85 * "rgb": {
86 * "b": 93,
87 * "g": 78,
88 * "r": 71
89 * }
90 * },
91 * {
92 * "rgb": {
93 * "b": 45,
94 * "g": 63,
95 * "r": 107
96 * }
97 * },
98 * {
99 * "rgb": {
100 * "b": 104,
101 * "g": 88,
102 * "r": 82
103 * }
104 * }
105 * ],
106 * "prominent": {
107 * "rgb": {
108 * "b": 47,
109 * "g": 36,
110 * "r": 31
111 * }
112 * }
113 * },
114 * "faces": [],
115 * "image": "wix:image://v1/d4dde1_e26da94b5cb440649ede0c433425449c~mv2.jpg/mountains.jpg#originWidth=5833&originHeight=3894"
116 * }
117 * },
118 * "mediaType": "IMAGE",
119 * "operationStatus": "READY",
120 * "parentFolderId": "media-root",
121 * "private": false,
122 * "siteId": "c96bcd13-173a-4938-88e0-a126391adf49",
123 * "sizeInBytes": "3013886",
124 * "thumbnailUrl": "https://static.wixstatic.com/media/d4dde1_e26da94b5cb440649ede0c433425449c~mv2.jpg",
125 * "url": "https://static.wixstatic.com/media/d4dde1_e26da94b5cb440649ede0c433425449c~mv2.jpg"
126 * },
127 * "triggeredByUndelete": true
128 * },
129 * "metadata": {
130 * "entityId": "d4dde1_e26da94b5cb440649ede0c433425449c~mv2.jpg",
131 * "eventTime": "2023-09-18T10:22:49.159Z",
132 * "id": "6057a4bd-86d1-428e-bfe5-026dcc869ec3",
133 * "triggeredByAnonymizeRequest": false
134 * }
135 * }
136 */
137