import type { DecompressHandlers, TypedMcapRecord } from "./types.ts"; type McapReaderOptions = { /** * When set to true, Chunk records will be returned from `nextRecord()`. Chunk contents will still * be processed after each chunk record itself. */ includeChunks?: boolean; /** * When a compressed chunk is encountered, the entry in `decompressHandlers` corresponding to the * compression will be called to decompress the chunk data. */ decompressHandlers?: DecompressHandlers; /** * When set to true (the default), chunk CRCs will be validated. Set to false to improve performance. */ validateCrcs?: boolean; /** * When set to true, the reader will not expect a magic prefix at the beginning of the stream. * This is useful when reading a stream that contains a fragment of an MCAP file, or when * reading starts in the middle of an MCAP file. */ noMagicPrefix?: boolean; }; /** * A streaming reader for MCAP files. * * Usage example: * ``` * const reader = new McapStreamReader(); * stream.on("data", (data) => { * try { * reader.append(data); * for (let record; (record = reader.nextRecord()); ) { * // process available records * } * } catch (e) { * // handle errors * } * }); * ``` */ export default class McapStreamReader { #private; constructor({ includeChunks, decompressHandlers, validateCrcs, noMagicPrefix, }?: McapReaderOptions); /** @returns True if a valid, complete mcap file has been parsed. */ done(): boolean; /** @returns The number of bytes that have been received by `append()` but not yet parsed. */ bytesRemaining(): number; /** * Provide the reader with newly received bytes for it to process. After calling this function, * call `nextRecord()` again to parse any records that are now available. */ append(data: Uint8Array): void; /** * Read the next record from the stream if possible. If not enough data is available to parse a * complete record, or if the reading has terminated with a valid footer, returns undefined. * * This function may throw any errors encountered during parsing. If an error is thrown, the * reader is in an unspecified state and should no longer be used. */ nextRecord(): TypedMcapRecord | undefined; } export {}; //# sourceMappingURL=McapStreamReader.d.ts.map