/gengzip

python module for gzipping data using generators

Primary LanguagePython

gengzip

https://travis-ci.org/leetreveil/gengzip.png

Python generators are cool. The compress() function returns a python generator with the gzipped data.

Installation

Install via pip:

$ pip install gengzip

Usage

input = [b'123', b'45']
# compress() returns a python generator object
# compresslevel defaults to 6
for compressed in gengzip.compress(input, compresslevel=6):
    print compressed

gzip data and write to file:

input = [b'123', b'45']
with open('output.gz', 'w') as f:
    for compressed in gengzip.compress(input):
        f.write(compressed)

Licence

MIT