UNPKG

obsidian-dev-utils

Version:

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

57 lines (56 loc) 2.43 kB
/** * @packageDocumentation * * Provides utility functions for working with attachment paths. */ import type { App, TFile } from 'obsidian'; import type { PathOrFile } from './FileSystem.cjs'; /** * Is overridden wrapper. */ export interface ExtendedWrapper { /** * Is extended. */ isExtended: true; } /** * Get available path for attachments function. */ export type GetAvailablePathForAttachmentsExtendedFn = (attachmentFileName: string, attachmentExtension: string, noteFile: null | TFile, shouldSkipMissingAttachmentFolderCreation?: boolean) => Promise<string>; /** * Retrieves the file path for an attachment within a note. * * @param app - The Obsidian application instance. * @param attachmentPathOrFile - The path of the attachment. * @param notePathOrFile - The path of the note. * @returns A {@link Promise} that resolves to the file path of the attachment. */ export declare function getAttachmentFilePath(app: App, attachmentPathOrFile: PathOrFile, notePathOrFile: PathOrFile): Promise<string>; /** * Retrieves the attachment folder path for a given note. * * @param app - The Obsidian application instance. * @param notePathOrFile - The path of the note. * @returns A {@link Promise} that resolves to the attachment folder path. */ export declare function getAttachmentFolderPath(app: App, notePathOrFile: PathOrFile): Promise<string>; /** * Retrieves the available path for attachments. * * @param app - The Obsidian application instance. * @param attachmentFileName - File name of the attachment. * @param attachmentExtension - Extension of the attachment. * @param noteFile - The file to attach to. * @param shouldSkipMissingAttachmentFolderCreation - Should missing attachment folder creation be skipped? * @returns A {@link Promise} that resolves to the available path for attachments. */ export declare function getAvailablePathForAttachments(app: App, attachmentFileName: string, attachmentExtension: string, noteFile: null | TFile, shouldSkipMissingAttachmentFolderCreation: boolean): Promise<string>; /** * Checks if a note has its own attachment folder. * * @param app - The Obsidian application instance. * @param path - The path of the note. * @returns A {@link Promise} that resolves to a boolean indicating whether the note has its own attachment folder. */ export declare function hasOwnAttachmentFolder(app: App, path: string): Promise<boolean>;