Skip to content

valgur/ncompress

Repository files navigation

ncompress PyPI Build PyPI - Downloads

LZW compression and decompression in Python and C++.

Ported with minimal changes from the (N)compress CLI tool.

Installation

Wheels are available for Python 3.8+ and all operating systems on PyPI.

pip install ncompress

Usage

Functions compress() and decompress() are available with the following inputs/outputs:

  • bytesbytes
  • BytesIObytes
  • BytesIO, BytesIONone
  • bytes, BytesIONone

The BytesIO-based functions are slightly (about 15%) faster due to avoiding a copy of the contents on bytesstd::string conversion.

Authors

The core functionality has been adapted from vapier/ncompress.

License

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.