Incremental compression

Steven D'Aprano steve+comp.lang.python at pearwood.info
Fri Feb 9 20:36:18 EST 2018


I want to compress a sequence of bytes one byte at a time. (I am already 
processing the bytes one byte at a time, for other reasons.) I don't 
particularly care *which* compression method is used, and in fact I'm not 
even interested in the compressed data itself, only its length. So I'm 
looking for something similar to this:

count = 0
for b in stream:
    process(b)
    count += incremental_compressor.compressor(b)



or some variation. Apart from bzip2, do I have any other options in the 
std lib?

https://docs.python.org/3/library/bz2.html#incremental-de-compression



-- 
Steve




More information about the Python-list mailing list