Gets information from the specified folder in the Media Manager.
The getFolder()
function returns a Promise that resolves to information about the specified folder.
This function requires elevated permissions and runs only on the backend and on dashboard pages.
function getFolder(folderId: string): Promise<Folder>;
Folder ID.
import { folders } from "wix-media.v2";
/* Sample folderId value: '30ed8f8a8f1e4a99b82c516cb212192f' */
async function myGetFolderFunction(folderId) {
try {
const folder = await folders.getFolder(folderId);
console.log("Successfully retrieved folder:", folder);
return folder;
} catch (error) {
console.error(error);
// Handle the error
}
}
/* Promise resolves to:
* {
* "_createdDate": "2023-08-22T08:31:06.000Z",
* "_id": "30ed8f8a8f1e4a99b82c516cb212192f",
* "_updatedDate": "2023-08-22T08:31:06.000Z",
* "displayName": "test2",
* "parentFolderId": "302fc049d70c41dea33fa4a27ab481ba",
* "state": "OK"
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.