mcap.stream_reader module¶
- class mcap.stream_reader.StreamReader(input: str | BytesIO | RawIOBase | BufferedReader | IO[bytes], skip_magic: bool = False, emit_chunks: bool = False, validate_crcs: bool = False, record_size_limit: int | None = 4294967296)[source]¶
Bases:
object
Reads MCAP data sequentially from an input stream.
- Parameters:
input – a file-like object for reading the source data from.
skip_magic – if
True
, will not expect MCAP magic at start or end of stream.emit_chunks – if
True
, will return Chunk records directly and do not parse out the records inside.validate_crcs – if
True
, will validate chunk and data section CRC values.record_size_limit – An upper bound to the size of MCAP records that this reader will attempt to load in bytes, defaulting to 4 GiB. If this reader encounters a record with a greater length, it will throw an
RecordLengthLimitExceeded
error. Setting toNone
removes the limit, but can allow corrupted MCAP files to trigger a MemoryError exception.
- property records: Iterator[McapRecord]¶
Returns records encountered in the MCAP in order.