Search.../

onFileDescriptorUpdated( )

Developer Preview

Triggered when a file is updated, including when a file is moved to a different folder.

Syntax

function wixMediaSiteMedia_onFileDescriptorUpdated(event: FileDescriptorUpdated): void

onFileDescriptorUpdated Parameters

NAME
TYPE
DESCRIPTION
event
Optional
FileDescriptorUpdated

Information about the updated 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 updated

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_onFileDescriptorUpdated(event) {
6 const eventTime = event.metadata.eventTime;
7 const fileName = event.entity.displayName;
8 const parentFolder = event.entity.parentFolderId;
9
10 console.log(`${fileName}, currently located in the parent folder with ID ${parentFolder}, was updated at ${eventTime}.`)
11}
12
13/* Full event object:
14 * {
15 * "metadata": {
16 * "id": "acfe4b7a-bc6a-41f5-8fb3-d0f1301fea51",
17 * "entityId": "d4dde1_e76448de45bf4deb912b373bc7c3ac6f~mv2.jpg",
18 * "eventTime": "2023-09-18T10:22:39.193Z",
19 * "triggeredByAnonymizeRequest": false
20 * },
21 * "entity": {
22 * "displayName": "image1",
23 * "mediaType": "IMAGE",
24 * "private": false,
25 * "operationStatus": "READY",
26 * "url": "https://static.wixstatic.com/media/d4dde1_e76448de45bf4deb912b373bc7c3ac6f~mv2.jpg",
27 * "_id": "d4dde1_e76448de45bf4deb912b373bc7c3ac6f~mv2.jpg",
28 * "_createdDate": "2023-08-09T08:45:43.000Z",
29 * "_updatedDate": "2023-09-18T10:22:38.000Z",
30 * "hash": "7fc91042c9a56b42223aa2f94ccdcecd",
31 * "labels": [
32 * "label1",
33 * "label2"
34 * ],
35 * "sizeInBytes": "6312959",
36 * "media": {
37 * "image": {
38 * "image": "wix:image://v1/d4dde1_e76448de45bf4deb912b373bc7c3ac6f~mv2.jpg/image1#originWidth=5616&originHeight=3744",
39 * "colors": {
40 * "prominent": {
41 * "rgb": {
42 * "r": 39,
43 * "g": 36,
44 * "b": 26
45 * }
46 * },
47 * "palette": [
48 * {
49 * "rgb": {
50 * "r": 39,
51 * "g": 36,
52 * "b": 26
53 * }
54 * },
55 * {
56 * "rgb": {
57 * "r": 119,
58 * "g": 125,
59 * "b": 135
60 * }
61 * },
62 * {
63 * "rgb": {
64 * "r": 208,
65 * "g": 209,
66 * "b": 208
67 * }
68 * },
69 * {
70 * "rgb": {
71 * "r": 130,
72 * "g": 108,
73 * "b": 40
74 * }
75 * },
76 * {
77 * "rgb": {
78 * "r": 75,
79 * "g": 101,
80 * "b": 133
81 * }
82 * },
83 * {
84 * "rgb": {
85 * "r": 94,
86 * "g": 78,
87 * "b": 36
88 * }
89 * },
90 * {
91 * "rgb": {
92 * "r": 148,
93 * "g": 161,
94 * "b": 178
95 * }
96 * },
97 * {
98 * "rgb": {
99 * "r": 163,
100 * "g": 177,
101 * "b": 192
102 * }
103 * },
104 * {
105 * "rgb": {
106 * "r": 208,
107 * "g": 184,
108 * "b": 159
109 * }
110 * },
111 * {
112 * "rgb": {
113 * "r": 183,
114 * "g": 159,
115 * "b": 137
116 * }
117 * }
118 * ]
119 * },
120 * "faces": []
121 * }
122 * },
123 * "siteId": "c96bcd13-173a-4938-88e0-a126391adf49",
124 * "thumbnailUrl": "https://static.wixstatic.com/media/d4dde1_e76448de45bf4deb912b373bc7c3ac6f~mv2.jpg",
125 * "parentFolderId": "b2bc72834460412494c93617d88b8c89"
126 * }
127 * }
128 */