compress¶
- tinycompress.rleb.compress(data, minsame=3, minpast=0)[source]¶
Compresses data using the RLEB algorithm.
This is a convenience function that creates a compressor, compresses the data, and returns the result.
- Parameters:
data (
Union[bytes,bytearray,memoryview,Iterable[int]]) – Data to compress.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:
Compressed data as bytes.
- Raises:
ValueError – If any parameters are out of their valid ranges.