Class McapStreamReader

A streaming reader for MCAP files.

Usage example:

const reader = new McapStreamReader();
stream.on("data", (data) => {
try {
for (let record; (record = reader.nextRecord()); ) {
// process available records
} catch (e) {
// handle errors


  • McapStreamReader



buffer: default = ...
channelsById: Map<number, Channel & {
    type: "Channel";
}> = ...
decompressHandlers: DecompressHandlers
doneReading: boolean = false
generator: Generator<undefined | TypedMcapRecord, undefined | TypedMcapRecord, void> = ...
includeChunks: boolean
noMagicPrefix: boolean
validateCrcs: boolean


  • 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.


    • data: Uint8Array

    Returns void

  • Returns

    The number of bytes that have been received by append() but not yet parsed.

    Returns number

  • Returns

    True if a valid, complete mcap file has been parsed.

    Returns boolean

  • 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.

    Returns undefined | TypedMcapRecord

Generated using TypeDoc