/** * Describes a file chunk produced by chunked output rendering. */ export interface OutputChunkFileDesc { filename: string; path: string; chunkId: number; } /** * Provides helpers for reading, merging, exporting, and deleting chunked render output. */ export declare class OutputChunkHelper { chunks: OutputChunkFileDesc[]; mimeType: string; extension: string; /** * Creates a helper for a set of output chunks. * * @param chunks Chunk descriptors in output order. * @param mimeType MIME type of the rendered media. * @param extension File extension to use when saving the output. */ constructor(chunks: OutputChunkFileDesc[], mimeType: string, extension: string); /** * Reads the raw bytes for a chunk by its numeric identifier. * * Attempts to read the chunk as Uint8Array from the chunkId. If the chunk exists and the read succeeds, the promise resolves to a * Uint8Array containing the file bytes. If the chunk is missing or an error occurs * during reading, the error is logged and the promise resolves to null. * * @param chunkId - The numeric identifier (index) of the chunk to read. * @returns A promise that resolves to the chunk's bytes as a Uint8Array, or null if the * chunk does not exist or could not be read. */ readChunkAsBytes(chunkId: number): Promise; /** * Reads the specified chunk and returns it as a Blob. * * @remarks * Not recommended because it will double the memory usage! * * If the chunk with the given id exists, this method attempts to read its bytes via readChunkBytes * and constructs a Blob using the instance's mimeType. If the chunk does not exist or the bytes * cannot be read, the promise resolves to null. * * @param chunkId - Identifier (index) of the chunk to read. * @returns A Promise that resolves to a Blob containing the chunk's data, or null if the chunk is missing or unreadable. * @throws Propagates any error thrown by readChunkBytes. */ readChunkAsBlob(chunkId: number): Promise; /** * Creates an object URL for the specified chunk if it exists. * * @remarks * Not recommended because it will double the memory usage! * * Attempts to read the chunk as a Blob (via `readChunkAsBlob`) and, if a Blob * is obtained, returns a URL created with `URL.createObjectURL(blob)`. If the * chunk is not present or cannot be read, the promise resolves to `null`. * * Note: callers are responsible for revoking the returned URL with * `URL.revokeObjectURL` when it is no longer needed to avoid memory leaks. * * @param chunkId - The identifier (index) of the chunk to read. * @returns A `Promise` that resolves to an object URL `string` for the chunk * Blob, or `null` if the chunk does not exist or could not be read. */ readChunkAsUrl(chunkId: number): Promise; /** * Reads and merges all chunks into a single Uint8Array. * * @returns {Promise} A promise that resolves to a merged Uint8Array containing all chunk data, * or null if an error occurs during reading or merging. * * @throws Does not throw, but logs errors at ERROR level if chunk reading or merging fails. * * @example * const mergedData = await helper.readMergedChunksAsBytes(); * if (mergedData) { * // Process merged chunk data * } */ readMergedChunksAsBytes(): Promise; /** * Reads merged chunks and converts them to a Blob object. * @remarks * Not recommended because it will double the memory usage! * @returns A promise that resolves to a Blob if chunks are successfully read and merged, * or null if no bytes are available. */ readMergedChunksAsBlob(): Promise; /** * Reads merged chunks and returns them as a URL object reference. * @remarks * Not recommended because it will double the memory usage! * Don't forget to revoke the URL after usage! * @returns A promise that resolves to a blob URL string, or null if no blob data is available. */ readMergedChunksAsUrl(): Promise; /** * Deletes a single chunk from the FFmpeg virtual filesystem. * * @param chunkId Numeric chunk identifier to remove. * @returns A promise that resolves after the deletion request completes. */ removeChunk(chunkId: number): Promise; /** * Deletes all known chunks from the FFmpeg virtual filesystem. * * @returns A promise that resolves after all chunk files have been removed. */ removeAllChunks(): Promise; /** * Checks whether the browser supports the File System Access save picker API. * * @returns `true` when `window.showSaveFilePicker` is available; otherwise `false`. */ isSaveToFileSupported(): boolean; /** * Prompts the user for a save location and writes all output chunks to the selected file. * * Uses the File System Access API (`showSaveFilePicker`) and writes each chunk sequentially. * * @param fileName - Suggested filename shown in the save dialog. * @param bufferSize - Reserved chunk step size in bytes. Defaults to `100 * 1024 * 1024` (100 MB). * @param progressCallback - Optional callback function to receive progress updates. range [0 - 1] * @returns A promise that resolves to `true` when all chunks are written successfully, otherwise `false`. */ browseAndSaveToFile(fileName: string, progressCallback?: ((progress: number) => void) | null, bufferSize?: number): Promise; }