@luis.bs/obsidian-attachments-cache
Version:
Store images and other attachments on the vault
23 lines (22 loc) • 1.16 kB
TypeScript
import type { App } from 'obsidian';
/** Public API for third-party integration. */
export interface AttachmentsCachePluginAPI {
/** Test whether the attachments should be cached. */
mayCache(notepath: string, remote: string): boolean;
/** Test whether a remote file is already cached. */
isCached(notepath: string, remote: string): Promise<boolean>;
/** Tries to map a remote url into a Vault resourcePath. */
resource(notepath: string, remote: string): Promise<string | undefined>;
/** Tries to map a remote url into a Vault filePath. */
resolve(notepath: string, remote: string): Promise<string | undefined>;
/** Tries to cache a file locally and returns a Vault resourcePath. */
cache(notepath: string, remote: string): 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) => AttachmentsCachePluginAPI | undefined;