https://github.com/synodriver/pylzf
pyLZF is a very small data compression library
https://github.com/synodriver/pylzf
cffi compress cython decompress
Last synced: 3 months ago
JSON representation
pyLZF is a very small data compression library
- Host: GitHub
- URL: https://github.com/synodriver/pylzf
- Owner: synodriver
- Created: 2022-06-30T14:19:24.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-10-13T15:04:23.000Z (over 2 years ago)
- Last Synced: 2025-10-27T04:36:09.885Z (7 months ago)
- Topics: cffi, compress, cython, decompress
- Language: Python
- Homepage:
- Size: 223 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
- Changelog: changename.py
Awesome Lists containing this project
README
✨ pylzf ✨
The python binding for liblzf
[](https://pypi.org/project/pylzf/)





### 安装
```bash
pip install pylzf
```
### 使用
```python
import pylzf
pylzf.compress(b"123", 100)
pylzf.decompress(b"xxx", 100)
data = bytearray(1000)
pylzf.compress_into(b"1212", data)
pylzf.decompress_into(b"xxxx", data)
```
### 公开函数
```python
def compress(data: bytes, outlen: int = ...) -> bytes: ...
def decompress(data: bytes, outlen: int) -> bytes: ...
def compress_into(data: bytes, out: bytearray) -> int: ...
def decompress_into(data: bytes, out: bytearray) -> int: ...
```
### 本机编译
```
python -m pip install setuptools wheel cython cffi
git clone https://github.com/synodriver/pylzf
cd pylzf
git submodule update --init --recursive
python setup.py bdist_wheel --use-cython --use-cffi
```
### 后端选择
默认由py实现决定,在cpython上自动选择cython后端,在pypy上自动选择cffi后端,使用```LZF_USE_CFFI```环境变量可以强制选择cffi