Re: Incremental compression

2018-02-09 Thread Steven D'Aprano
On Fri, 09 Feb 2018 17:52:33 -0800, Dan Stromberg wrote: > Perhaps: > > import lzma > lzc = lzma.LZMACompressor() Ah, thanks for the suggestion! -- Steve -- https://mail.python.org/mailman/listinfo/python-list

Re: Incremental compression

2018-02-09 Thread Dan Stromberg
Perhaps: import lzma lzc = lzma.LZMACompressor() out1 = lzc.compress(b"Some data\n") out2 = lzc.compress(b"Another piece of data\n") out3 = lzc.compress(b"Even more data\n") out4 = lzc.flush() # Concatenate all the partial results: result = b"".join([out1, out2, out3, out4]) ? lzma compresses

Incremental compression

2018-02-09 Thread Steven D'Aprano
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

Re: Incremental Compression

2006-03-25 Thread Eyal Lotem
Adam DePrince wrote: On Sat, 2006-03-25 at 03:08 +0200, Eyal Lotem wrote: Hey. I have a problem in some network code. I want to send my packets compressed, but I don't want to compress each packet separately (via .encode('zlib') or such) but rather I'd like to compress it with regard to

Incremental Compression

2006-03-24 Thread Eyal Lotem
Hey. I have a problem in some network code. I want to send my packets compressed, but I don't want to compress each packet separately (via .encode('zlib') or such) but rather I'd like to compress it with regard to the history of the compression stream. If I use zlib.compressobj and flush it to

Re: Incremental Compression

2006-03-24 Thread Adam DePrince
On Sat, 2006-03-25 at 03:08 +0200, Eyal Lotem wrote: Hey. I have a problem in some network code. I want to send my packets compressed, but I don't want to compress each packet separately (via .encode('zlib') or such) but rather I'd like to compress it with regard to the history of the