export declare function downloadFileFromUrl(url: string, filename: string, opts?: { credentials?: RequestCredentials; }): Promise<{ bytes: number; }>; export interface ShareableFile { url: string; filename: string; mimeType?: string; } export type ShareOrDownloadResult = { delivered: "share"; count: number; } | { delivered: "download"; count: number; }; /** "shared" = the sheet completed, "cancelled" = the user dismissed it, * "unsupported" = Web Share (files) unavailable. A genuine share failure THROWS. */ export type ShareFilesResult = "shared" | "cancelled" | "unsupported"; /** * Whether this browser can share FILES at all — true on most mobile browsers, * false on desktop and inside an iframe the host has not granted * `allow="web-share"`. Probed with a dummy File, so the answer costs no fetch: * that is what lets a menu decide whether to OFFER Share before it holds any * bytes. The share PATHS below re-check against the real files, because a * browser that can share something may still refuse a particular set. */ export declare function canShareFiles(): boolean; /** * Fetch `files` into File objects ready for {@link shareFiles}, to be done BEFORE * the share gesture so the share call itself stays synchronous (the iOS note * above). Returns the File[] when Web Share (files) is supported and the set is * shareable; returns `null` when Web Share is unavailable or the set isn't * shareable (the caller should download instead). THROWS if a fetch fails, so the * caller can log the real reason rather than silently downloading. */ export declare function prepareShareFiles(files: ShareableFile[], opts?: { credentials?: RequestCredentials; }): Promise; /** * Share already-fetched File objects via the OS sheet. Call SYNCHRONOUSLY from a * user gesture (no awaited fetch before it) so iOS keeps the transient activation. * "cancelled" = user dismissed, "unsupported" = no Web Share; a real failure THROWS. */ export declare function shareFiles(fileObjs: File[], opts?: { title?: string; text?: string; }): Promise; /** * All-in-one: fetch + share, else download each file (never a ZIP). Best for FAST * URLs (presigned R2) where the fetch fits inside the iOS activation window; for * slow URLs, prepare ahead with {@link prepareShareFiles} + {@link shareFiles}. */ export declare function shareOrDownloadFiles(files: ShareableFile[], opts?: { title?: string; text?: string; credentials?: RequestCredentials; }): Promise;