lzf
lzf allows reading and writing files compressed with the LZF compression format.
To crib some of the features listed for LibLZF:
Very fast compression speeds.
Mediocre compression ratios - you can usually expect about 40-50% compression for typical binary data Easy to use (just two functions, no state attached).
Freely usable (BSD-type-license)
API
This package provides reading and writing LZF data as Python file like objects.
lzf.open(file, mode='r', encoding=None, errors=None)
Open a LZF stream for reading or writing.
file may be a path to an on-disk file, or a file-like object open for reading or writing (whatever you pass to mode).
mode must be r or w to indicate reading or writing, optionally with b or t to indicate binary or text-mode IO. If the mode is text (the default), then U is also accepted to turn on universal newline mode.
encoding and errors are as for the built-in open() function.
Note that lzf.open() takes the Python 3 model for text IO, even on Python 2. Unless mode contains 'b', then the returned file-like object will read or write Unicode strings.
Examples
To open an on-disk LZF-compressed text file and print it linewise:
import lzf
with lzf.open('/path/to/file.txt.lzf') as f:
for line in f:
print(line)
To compress some binary data with LZF:
import lzf
with lzf.open('/path/to/file.lzf', 'wb') as f:
f.write(b'hello world')
To read LZF compressed CBOR structures from a URL:
import lzf
import cbor2
from urllib.request import urlopen # Use urllib2 in Python 2
SOME_URL = 'http://example.com/data.cbor.lzf'
with lzf.open(urlopen(SOME_URL), 'rb') as f:
print(cbor2.load(f))
(You’ll need cbor2 installed if you want to try this.)
Metadata
Release files for lzf 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lzf-0.1.tar.gz | 28.4 kB | Without provenance | Details for lzf-0.1.tar.gz |
Release files / lzf-0.1.tar.gz
| Download URL | lzf-0.1.tar.gz |
|---|---|
| Size | 28.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2163a5172f7328baa4a5a0a351617a4d92a5d264975e67f581ed24a9dcf8893b
|
|
BLAKE2b-256 checksum How to use checksums |
eff770aa6aacd6bc865e74dae319bb262078d59f6cf90584da2bbe7307b52565
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for lzf 0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.