@luis.bs/obsidian-attachments-cache
Version:
Store images and other attachments on the vault
21 lines (20 loc) • 1.16 kB
TypeScript
import type { App } from 'obsidian';
/** Public API for third-party integration. */
export interface AttachmentsCacheApi {
/** Determine whether the attachment matches a **short-term** storage rule. */
isCacheable(remote: string, notepath: string, frontmatter?: unknown): boolean;
/** Download the attachment and get the localpath. */
cache(remote: string, notepath: string, frontmatter?: unknown): Promise<string | undefined>;
/** Determine whether the attachment matches a **long-term** storage rule. */
isArchivable(remote: string, notepath: string, frontmatter?: unknown): boolean;
/** Download the attachment, update the reference on the note and get the localpath. */
archive(remote: string, notepath: string, frontmatter?: unknown): Promise<string | undefined>;
}
/** Determine if Dataview is enabled in the given application. */
export declare const isPluginEnabled: (app: App) => void;
/**
* Get the current AttachmentsCache API from the app if provided;
* otherwise it is inferred from the global API object installed
* on the window.
*/
export declare const getAPI: (app?: App) => AttachmentsCacheApi | undefined;