getOrCreateFileSafe
Gets or creates a file safely in the specified path.
If the file already exists, it will be returned. If the file does not exist, it will be created and returned.
Import:
import { getOrCreateFileSafe } from 'obsidian-dev-utils/obsidian/vault';Signature:
function getOrCreateFileSafe(app: App, path: string): Promise<TFile>Parameters:
| Parameter | Type | Description |
|---|---|---|
app | App | The application instance. |
path | string | The path of the file to get or create. |
Returns: Promise<TFile> — A Promise that resolves to the file.