space_packet_parser.generators.fixed_length

Fixed length packet generator.

Functions

fixed_length_generator(→ collections.abc.Iterator[bytes])

A generator that yields fixed-length chunks from binary_data.

Module Contents

space_packet_parser.generators.fixed_length.fixed_length_generator(binary_data: BinaryIO | socket.socket | bytes, *, packet_length_bytes: int, buffer_read_size_bytes: int | None = None, show_progress: bool = False) collections.abc.Iterator[bytes]

A generator that yields fixed-length chunks from binary_data.

Parameters:
  • binary_data (Union[BinaryIO, socket.socket, bytes]) – Binary data source.

  • packet_length_bytes (int) – Number of bytes per packet to yield.

  • buffer_read_size_bytes (int, optional) – Number of bytes to read from the source per read.

  • show_progress (bool) – If True, prints a status bar.

Yields:

bytes – Fixed-length packet bytes.