Gets a folder's information from the Media Manager by folderId
.
The getFolderInfo()
function returns a Promise that resolves to information about
the specified folder.
The folderId
property is the internal name (unique identifier) which is generated when a folder is created by the Media Manager.
function getFolderInfo(folderId: string): Promise<FolderInfo>;
Internal name (unique identifier) which is generated when a folder is created by the Media Manager.
import { Permissions, webMethod } from "wix-web-module";
import { mediaManager } from "wix-media-backend";
const folderId = "1bf317e889264736b5acb367415fad8e";
export const myGetFolderInfoFunction = webMethod(
Permissions.Anyone,
async () => {
try {
const myFolder = await mediaManager.getFolderInfo(folderId);
const folderName = myFolder.folderName;
const updatedDate = myFolder._updatedDate;
return myFolder;
} catch (error) {
console.error(error);
}
},
);
/* Returns a promise that resolves to:
* {
* "folderId": "1bf317e889264736b5acb367415fad8e",
* "folderName": "greatfolder1",
* "parentFolderId": "media-root",
* "_createdDate": "Sun December 4 2020 14:56:15 GMT+0300",
* "_updatedDate": "Wed May 12 2021 14:56:15 GMT+0300"
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.