open

tinycompress.rleb.open(filename, mode='r', encoding=None, errors=None, newline=None, minsame=3, minpast=0)[source]

Opens an RLEB compressed file.

This provides a high-level interface similar to the built-in open() function but for RLEB compressed files. It supports both binary and text modes.

Parameters:
  • filename (str | bytes | IO) – Path to file or file object.

  • mode (str) – File open mode (‘r’/’rb’ for reading, ‘w’/’wb’/’x’/’xb’/’a’/’ab’ for writing).

  • encoding (str | None) – Text encoding for text mode.

  • errors (str | None) – How to handle encoding/decoding errors in text mode.

  • newline (str | None) – How to handle newlines in text mode.

  • minsame (int) – Minimum compressed size, within MINSAME_MIN and MINSAME_MAX.

  • minpast (int) – Minimum bytes after a same streak, within MINPAST_MIN and MINPAST_MAX.

Returns:

A CodecFile for binary mode or TextIOWrapper for text mode.