libtcspc.WriteBinaryStream

final class libtcspc.WriteBinaryStream(stream, buffer_provider=None, write_granularity_bytes=65536)[source]

Bases: Node

Sink processor that writes raw bytes to a binary output stream.

Input is a BucketEvent of bytes; the contained bytes are written to the output stream. To write typed events, precede this processor with ViewAsBytes (and usually Batch) to convert bucketed events to their in-memory bytes. This processor is a sink: it has no outputs.

Parameters:

Notes

Events handled:

  • BucketEvent of byte event type: write its bytes to the stream.

  • All other event types: rejected at graph build time.

  • End of input: flush the stream. Raises an exception (corresponding to C++ input_output_error) on a stream write error.

See also

tcspc::write_binary_stream()

The underlying C++ factory function.

ViewAsBytes

View bucketed events as their in-memory bytes to feed this sink.

ReadBinaryStream

The inverse: read events from a binary input stream.

write_events_to_binary_file

Higher-level convenience that accepts individual events and writes them to a binary file (batching and byte conversion handled internally).