Skip to content

getOrCreateFolderSafe

Gets or creates a folder safely in the specified path.

If the folder already exists, it will be returned. If the folder does not exist, it will be created and returned.

Import:

import { getOrCreateFolderSafe } from 'obsidian-dev-utils/obsidian/vault';

Signature:

function getOrCreateFolderSafe(app: App, path: string): Promise<TFolder>

Parameters:

ParameterTypeDescription
appAppThe application instance.
pathstringThe path of the folder to get or create.

Returns: Promise<TFolder> — A Promise that resolves to the folder.