Skip to content

getOrCreateFile

Retrieves the file for the given path or creates a new one if it does not exist.

Import:

import { getOrCreateFile } from 'obsidian-dev-utils/obsidian/file-system';

Signature:

function getOrCreateFile(app: App, path: string): Promise<TFile>

Parameters:

ParameterTypeDescription
appAppThe Obsidian App instance.
pathstringThe path of the file to retrieve or create.

Returns: Promise<TFile> — The file representing the file