Library for indexing LZO compressed files
Project description
Python library for indexing block offsets within LZO compressed files. The implementation is largely based on that of the Hadoop Library. Index files are used to allow Hadoop to split a single file compressed with LZO into several chunks for parallel processing.
Since LZO is a block based compression algorithm, we can split the file along the lines of blocks and decompress each block on it’s own. The index is a file containing byte offsets for each block in the original LZO file.
This library is python3 fork of python-lzo-indexer.
Example
The python code below demonstrates how easy it is to index an LZO file. This library also supports indexing a string, and a method to return the individual block offsets should you need to create a file of your own format.
import lzo_indexer
with open("my-file.lzo", "r") as f, open("my-file.lzo.index", "rw") as index:
lzo_indexer.index_lzo_file(f, index)
Command-line Utility
This library also includes a utility for indexing multiple lzo files, using the python indexer. This is a much faster alternative to the command line utility built into the hadoop-lzo library as it avoids the JVM.
$ lzo_indexer --help Usage: lzo_indexer [OPTIONS] <files to index> Tool for indexing LZO compressed files Options: -t, --threads INTEGER Processing threads count -e, --extension TEXT Index file extension -f, --force Force re-creation of an index even if it exists -h, --help Show this message and exit.
Contributions
I welcome any contributions, though I request that any pull requests come with test coverage.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for python3_lzo_indexer-0.2.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c5ab2d0caf5488f4ae9000662e300e906f631dd26c539d7782ea0ce1f61e470 |
|
MD5 | 5b615ee317db3d68f2281b8524b32496 |
|
BLAKE2b-256 | 3fbab2c61ffdb54023910dae66ddc6a877918afb2f460911740073db1ed4fa55 |
Hashes for python3_lzo_indexer-0.2.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dbbfd2e62225628ab6c0cf315b0782b6aa4a9957d78c26751a8eda4144cefa86 |
|
MD5 | 9f0e7037dda0a12a43afe90fff3d3b3f |
|
BLAKE2b-256 | 62cc761b7876f9f817ef3deffe4afdbe4ea5aa1868e74cf88ea3ec072d0c56f7 |