export { FileDownload }; export { BlobDownload }; export { isFileDownload }; export { isBlobDownload }; import { LazyBlob, LazyFile } from '../../LazyFile.js'; import type { StreamSource, FileDownloadMetadata, BlobDownloadMetadata, DownloadProgress } from '../../types.js'; declare const FILE_DOWNLOAD_BRAND: unique symbol; declare const BLOB_DOWNLOAD_BRAND: unique symbol; declare function isFileDownload(value: unknown): value is FileDownload; declare function isBlobDownload(value: unknown): value is BlobDownload; /** File-shaped streaming download. Inherits Blob/File methods (`stream`/`arrayBuffer`/ * `text`/`slice`) from `LazyFile`; overrides `bytes` to use the StreamSource's built-in * onChunk hook for progress + cancel detection. */ declare class FileDownload extends LazyFile { #private; readonly [FILE_DOWNLOAD_BRAND] = true; constructor(metadata: FileDownloadMetadata, source: StreamSource); get loaded(): number; onProgress(cb: DownloadProgress): void; cancel(): void; stream(): ReadableStream>; /** Saves to user's filesystem. `opts.mode` selects the path: * - `'picker'` — opens [`showSaveFilePicker`](https://developer.mozilla.org/en-US/docs/Web/API/Window/showSaveFilePicker) * so the user chooses the location (throws if not supported). * - `'memory'` — buffers in RAM, then triggers a native browser download (Downloads folder). * - `'opfs'` — streams via browser-private storage, then triggers a native download (for * huge files where memory buffering isn't viable). * * Default: `'picker'` if `showSaveFilePicker` is available, else `'memory'`. */ saveToDisk(opts?: { mode?: 'picker' | 'memory' | 'opfs'; }): Promise; /** Streams into OPFS (browser-private), returns a disk-backed `File` for `URL.createObjectURL` etc. */ saveToOpfs(path?: string): Promise; /** Buffers all bytes into memory, returns a real `File`. */ saveToMemory(): Promise; } /** Blob-shaped streaming download. Same shape as FileDownload minus name/lastModified. */ declare class BlobDownload extends LazyBlob { #private; readonly [BLOB_DOWNLOAD_BRAND] = true; constructor(metadata: BlobDownloadMetadata, source: StreamSource); get loaded(): number; onProgress(cb: DownloadProgress): void; cancel(): void; stream(): ReadableStream>; /** Saves to user's filesystem. `opts.mode` selects the path: * - `'picker'` — opens [`showSaveFilePicker`](https://developer.mozilla.org/en-US/docs/Web/API/Window/showSaveFilePicker) * so the user chooses the location (throws if not supported). * - `'memory'` — buffers in RAM, then triggers a native browser download (Downloads folder). * - `'opfs'` — streams via browser-private storage, then triggers a native download (for * huge files where memory buffering isn't viable). * * Default: `'picker'` if `showSaveFilePicker` is available, else `'memory'`. */ saveToDisk(opts?: { mode?: 'picker' | 'memory' | 'opfs'; }): Promise; /** Streams into OPFS (browser-private), returns a disk-backed `File` for `URL.createObjectURL` etc. */ saveToOpfs(path?: string): Promise; /** Buffers all bytes into memory, returns a real `Blob`. */ saveToMemory(): Promise; }