LZW compression and decompression in Python and C++.
Ported with minimal changes from the (N)compress CLI tool.
Wheels are available for Python 3.8+ and all operating systems on PyPI.
pip install ncompress
Functions compress()
and decompress()
are available with the following inputs/outputs:
bytes
→bytes
BytesIO
→bytes
BytesIO
,BytesIO
→None
bytes
,BytesIO
→None
The BytesIO
-based functions are slightly (about 15%) faster due to avoiding a copy of the contents on bytes
⇄std::string
conversion.
- Martin Valgur (@valgur)
The core functionality has been adapted from vapier/ncompress.
All modifications and additions are released under the Unlicense.
The base (N)compress code has been released into the public domain.
The BytesIO
wrapper in pystreambuf.h has been adapted from the cctbx project and is licensed under the Lawrence Berkeley National Labs BSD variant license.
See the linked file for details.