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
}
});

Hierarchy

  • McapStreamReader

Constructors

Properties

#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

Methods

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

    Parameters

    • data: Uint8Array

    Returns void

  • Returns number

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

  • Returns boolean

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

  • 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