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 '@mnaoumov/obsidian-lib/file-system';

Signature:

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

Parameters:

Parameter Type Description
app App The Obsidian App instance.
path string The path of the file to retrieve or create.

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