/** * Saving a blob to the user's disk, shared by every MolVis surface. * * `sketch` and `stage` had one mechanism each and neither could reach the * other's: stage opened a File System Access picker and *threw* where the * API was missing (Firefox, Safari, most embedded webviews); sketch always * used an anchor download and so never offered a picker even in browsers * that support one. This module does the picker when available and falls * back to the anchor, so both surfaces behave the same everywhere. */ declare global { interface Window { showSaveFilePicker?: (options?: { suggestedName?: string; types?: { description?: string; accept: Record; }[]; }) => Promise<{ createWritable(): Promise<{ write(data: Blob): Promise; close(): Promise; }>; }>; } } export interface SaveFileType { description?: string; /** MIME type → extensions, e.g. `{ "chemical/x-pdb": [".pdb"] }`. */ accept: Record; } export interface SaveBlobOptions { /** * File-type filters for the save picker. Ignored by the anchor * fallback, which can only honour the suggested filename. */ types?: SaveFileType[]; } /** * Write `blob` to a user-chosen location. * * Resolves once the bytes are handed off. The anchor fallback resolves as * soon as the download is triggered — the browser owns it from there, so * neither path can report where the file actually landed. */ export declare function saveBlob(blob: Blob, suggestedName: string, options?: SaveBlobOptions): Promise; /** * Anchor-based download — the fallback for hosts without the File System * Access API. Exported because a caller may want to force it (a headless * or automated context where a picker would block). */ export declare function downloadBlob(blob: Blob, filename: string): void;