Retrieves a list of files in the Media Manager's trash bin.
The listDeletedFiles()
function returns a Promise that resolves to an array of the specified deleted files' descriptors and cursor information.
Note: The Media Manager's trash bin (TRASH_ROOT
folder) only contains temporarily deleted files, not permanently deleted files.
To retrieve a list of non-deleted files, use the listFiles()
function.
This function requires elevated permissions and runs only on the backend and on dashboard pages.
function listDeletedFiles(
options: ListDeletedFilesOptions,
): Promise<ListDeletedFilesResponse>;
Options to use when listing deleted files from the trash bin.
import { files } from "wix-media.v2";
async function myListDeletedFilesFunction() {
try {
const deletedFiles = await files.listDeletedFiles();
console.log("Files in trash:", deletedFiles);
return deletedFiles;
} catch (error) {
console.error(error);
// Handle the error
}
}
/* Promise resolves to:
* {
* "files": [
* {
* "_createdDate": "2023-08-09T08:45:42.000Z",
* "_id": "d4dde1_32288e20a5aa4213a52b15426fb27c9f~mv2.png",
* "_updatedDate": "2023-08-09T08:45:42.000Z",
* "displayName": "image1.png",
* "hash": "864d607a1ea270efbac32def181f039f",
* "internalTags": [
* "_fileOrigin_uploaded"
* ],
* "labels": [],
* "media": {
* "image": {
* "colors": {
* "palette": [
* {
* "rgb": {
* "b": 247,
* "g": 247,
* "r": 247
* }
* },
* {
* "rgb": {
* "b": 142,
* "g": 140,
* "r": 140
* }
* },
* {
* "rgb": {
* "b": 192,
* "g": 218,
* "r": 141
* }
* },
* {
* "rgb": {
* "b": 195,
* "g": 137,
* "r": 149
* }
* },
* {
* "rgb": {
* "b": 228,
* "g": 143,
* "r": 183
* }
* },
* {
* "rgb": {
* "b": 250,
* "g": 62,
* "r": 152
* }
* },
* {
* "rgb": {
* "b": 16,
* "g": 16,
* "r": 16
* }
* },
* {
* "rgb": {
* "b": 140,
* "g": 199,
* "r": 60
* }
* },
* {
* "rgb": {
* "b": 120,
* "g": 194,
* "r": 242
* }
* },
* {
* "rgb": {
* "b": 158,
* "g": 203,
* "r": 103
* }
* }
* ],
* "prominent": {
* "rgb": {
* "b": 247,
* "g": 247,
* "r": 247
* }
* }
* },
* "faces": [],
* "image": "wix:image://v1/d4dde1_32288e20a5aa4213a52b15426fb27c9f~mv2.png/image1.png#originWidth=1170&originHeight=2532"
* }
* },
* "mediaType": "IMAGE",
* "operationStatus": "READY",
* "parentFolderId": "trash-root",
* "private": false,
* "siteId": "3ecba886-4267-11ee-be56-0242ac120002",
* "sizeInBytes": "394945",
* "state": "OK",
* "thumbnailUrl": "https://static.wixstatic.com/media/d4dde1_32288e20a5aa4213a52b15426fb27c9f~mv2.png",
* "url": "https://static.wixstatic.com/media/d4dde1_32288e20a5aa4213a52b15426fb27c9f~mv2.png"
* },
* {
* "_createdDate": "2023-08-09T08:45:37.000Z",
* "_id": "d4dde1_8dd2bfe6121f43b29ebeaa63988abf54.svg",
* "_updatedDate": "2023-08-09T08:45:37.000Z",
* "displayName": "vectorArt1.svg",
* "hash": "e379083c3675d7f7891da00c0708539c",
* "internalTags": [
* "_fileOrigin_uploaded"
* ],
* "labels": [],
* "media": {
* "image": {
* "faces": [],
* "image": "wix:image://v1/d4dde1_8dd2bfe6121f43b29ebeaa63988abf54.svg/vectorArt1.svg#originWidth=1177&originHeight=2501"
* }
* },
* "mediaType": "VECTOR",
* "operationStatus": "READY",
* "parentFolderId": "trash-root",
* "private": false,
* "siteId": "3ecba886-4267-11ee-be56-0242ac120002",
* "sizeInBytes": "119475",
* "state": "OK",
* "thumbnailUrl": "https://static.wixstatic.com/shapes/d4dde1_8dd2bfe6121f43b29ebeaa63988abf54.svg",
* "url": "https://static.wixstatic.com/shapes/d4dde1_8dd2bfe6121f43b29ebeaa63988abf54.svg"
* }
* ],
* "nextCursor": {
* "cursors": {
* "next": ""
* },
* "hasNext": false
* }
* }
*/
There are 2 errors with this status code.
This method may also return standard errors. Learn more about standard Wix errors.