import { registerPlugin, type PluginListenerHandle } from "@capacitor/core"; export interface ContentDownloadProgress { readonly logicalPath: string; readonly downloadedBytes: number; readonly totalBytes: number; } export interface NativeContentFileResult { readonly fileUri: string; readonly bytes: number; readonly reused: boolean; } interface DownloadOptions { readonly url: string; readonly logicalPath: string; readonly sha256: string; readonly extension: string; readonly bytes: number; readonly encoding?: "gzip"; readonly downloadSha256?: string; readonly downloadBytes?: number; } interface ObjectOptions { readonly sha256: string; readonly extension: string; } interface NativeContentStoragePlugin { download(options: DownloadOptions): Promise; remove(options: ObjectOptions): Promise; has(options: ObjectOptions & { readonly bytes: number }): Promise<{ readonly exists: boolean; readonly fileUri?: string }>; getFreeBytes(): Promise<{ readonly freeBytes: number }>; addListener( eventName: "downloadProgress", listener: (event: ContentDownloadProgress) => void, ): Promise; } export const NativeContentStorage = registerPlugin("ContentStorage");