https://github.com/scivision/unlzw3
Pure Python unlzw to open .Z files on any platform running Python
https://github.com/scivision/unlzw3
Last synced: 3 months ago
JSON representation
Pure Python unlzw to open .Z files on any platform running Python
- Host: GitHub
- URL: https://github.com/scivision/unlzw3
- Owner: scivision
- License: other
- Created: 2020-02-10T07:13:24.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-12-20T20:23:12.000Z (7 months ago)
- Last Synced: 2025-04-12T08:13:15.982Z (3 months ago)
- Language: Python
- Homepage: https://github.com/umeat/unlzw
- Size: 74.2 KB
- Stars: 8
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# unlzw3
[](https://github.com/scivision/unlzw3/actions/workflows/ci.yml)
[](http://pepy.tech/project/unlzw3)Pure Python decompression module for .Z files compressed using Unix compress utility.
Unlike the faster but Linux-specific
[unlzw](https://pypi.org/project/unlzw/)
using Python CFFI, `unlzw3` is slower but works on any platform that runs Python including Windows.This is a purely Python adaptation of Mark Adler's
['unlzw' C function](http://mathematica.stackexchange.com/questions/60531/how-can-i-read-compressed-z-file-automatically-by-mathematica/60879#60879)
on Stackoverflow.
Python can be much slower than using any compiled utility for the same purpose.## Usage
`unlzw3.unlzw(data)` takes LZW .Z compressed data as any type which can be converted to a bytearray (generally a string).
It returns a UTF-8 decoded string containing the decompressed data.```python
import unlzw3
from pathlib import Pathuncompressed_data = unlzw3.unlzw(Path('file.Z').read_bytes())
# or
uncompressed_data = unlzw3.unlzw(Path('file.Z'))
```## Contributions
* reference C code: Mark Adler
* pure Python implemetation: [Brandon Owen](https://github.com/umeat/unlzw)
* modernization, test / CI and PyPi: Michael Hirsch