UNPKG

obsidian-dev-utils

Version:

This is the collection of useful functions that you can use for your Obsidian plugin development

37 lines (36 loc) 1.78 kB
/** * @packageDocumentation * * This module provides additional utilities for working with the Obsidian Vault. * * It has to be extracted from `Vault` because of circular dependencies. */ import type { App } from 'obsidian'; import type { PathOrAbstractFile, PathOrFolder } from './FileSystem.cjs'; /** * Deletes an empty folder. * * @param app - The application instance. * @param pathOrFolder - The folder to delete. * @returns A {@link Promise} that resolves when the folder is deleted. */ export declare function deleteEmptyFolder(app: App, pathOrFolder: null | PathOrFolder): Promise<void>; /** * Removes empty folder hierarchy starting from the given folder. * * @param app - The application instance. * @param pathOrFolder - The folder to start removing empty hierarchy from. * @returns A {@link Promise} that resolves when the empty hierarchy is deleted. */ export declare function deleteEmptyFolderHierarchy(app: App, pathOrFolder: null | PathOrFolder): Promise<void>; /** * Deletes abstract file safely from the vault. * * @param app - The Obsidian application instance. * @param pathOrFile - The path or abstract file to delete. * @param deletedNotePath - Optional. The path of the note that triggered the removal. * @param shouldReportUsedAttachments - Optional. If `true`, a notice will be shown for each attachment that is still used by other notes. * @param shouldDeleteEmptyFolders - Optional. If `true`, empty folders will be deleted. * @returns A {@link Promise} that resolves to a boolean indicating whether the removal was successful. */ export declare function deleteSafe(app: App, pathOrFile: PathOrAbstractFile, deletedNotePath?: string, shouldReportUsedAttachments?: boolean, shouldDeleteEmptyFolders?: boolean): Promise<boolean>;