Fast random access to bzip2 files
Project description
indexed_bzip2
This module provides an IndexedBzip2File class, which can be used to seek inside bzip2 files without having to decompress them first. It's based on an improved version of the bzip2 decoder bzcat from toybox, which was refactored and extended to be able to export an import bzip2 block offsets and seek to them. Seeking inside a block is only emulated, so IndexedBzip2File will only speed up seeking when there are more than one blocks, which should almost always be the cause for archives larger than 1 MB.
Installation
You can simply install it from PyPI:
pip install indexed_bzip3
Usage
Example 1
from indexed_bzip2 import IndexedBzip2File
file = IndexedBzip2File( "example.bz2" )
# You can now use it like a normal file
file.seek( 123 )
data = file.read( 100 )
The first call to seek will ensure that the block offset list is complete and therefore might create them first. Because of this the first call to seek might take a while.
Example 2
The creation of the list of bzip2 blocks can take a while because it has to decode the bzip2 file completely. To avoid this setup when opening a bzip2 file, the block offset list can be exported and imported.
from indexed_bzip2 import IndexedBzip2File
file = IndexedBzip2File( "example.bz2" )
blockOffsets = file.blockOffsets() # can take a while
file.close()
file2 = IndexedBzip2File( "example.bz2" )
blockOffsets = file2.setBlockOffsets( blockOffsets ) # should be fast
file2.seek( 123 )
data = file2.read( 100 )
file2.close()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for indexed_bzip2-1.0.0-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | da511bc13c3a248ea6f13c36b6b5b28123522943bd4215195728c9a31f21d14d |
|
MD5 | 8165eee73a06d604148af97e04bcd77a |
|
BLAKE2b-256 | 9f850c57bcf12abb796068613fa66dc9fad564ffc7f921f626da7aeb9652bfed |
Hashes for indexed_bzip2-1.0.0-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e1546d3b26fe6f1f3b59ac6a95ca90af520a78c58af418a7aa58e3ecd33f980 |
|
MD5 | 87af3b2f23f4a5221a0557ee2225725e |
|
BLAKE2b-256 | aa8d2f3f6b86be2a974f70e26f148aceb5eaaf0fede26ae68b95b17e00c0da0b |
Hashes for indexed_bzip2-1.0.0-cp38-cp38-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c4550d8ac91c0eb68c4081576f6903084b3e5784b3febe94d53ce88987000e6 |
|
MD5 | d9e3ade9dee6bdaf8211874b4c05dd87 |
|
BLAKE2b-256 | ba09f3b8cb2ec028f556887d8cba9144083ecb69a561f04db47f3172e43016dd |
Hashes for indexed_bzip2-1.0.0-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d08d69e844fee2c5b8da8a15c7df39ed7e87caf71f5c935ff7a84639521001b |
|
MD5 | 0c5aab386faac58c73078414e6612d18 |
|
BLAKE2b-256 | 9217ccccbf1184fdaa5f914aaf82eded81106dcc0c9adb25607fbe13d13d5ed6 |
Hashes for indexed_bzip2-1.0.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 768dac7fb33688b57190a3c0e29b86ad653c4b5ccfe3022df2b0da2c77f09836 |
|
MD5 | a3c39140ebb8bddff64fe0d96adc3bee |
|
BLAKE2b-256 | 9fd5c1a0e6d1204c3258298479a92225b31f486dd66848207731d4f8c68212e1 |
Hashes for indexed_bzip2-1.0.0-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9658b647ca53e6cd2a21e48c2b0f8e4525f497b94486fa1e981b67fef6ad228d |
|
MD5 | 7698785b742495bf6adb00e2faa0a0b5 |
|
BLAKE2b-256 | 03d8714a3450b321c1a83caf0e61086a75a29072e5baeb3a8c3572f99e2921c6 |
Hashes for indexed_bzip2-1.0.0-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ae23b9a98cea58356d97fc89f510774a69d2a32dffe4a6efad9b7bbac8f4fe0 |
|
MD5 | 6f3fdadb5a59ee12707bc394e68adfcc |
|
BLAKE2b-256 | d16531faf9b168baac247a7261ea3e8f7f045bcdadaa95d043d00746b7c4639f |
Hashes for indexed_bzip2-1.0.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4cb24c8d1ac5dd68a7d74c4861942da00bc97986802b9572b87b8d86157abe99 |
|
MD5 | d06a2cd2e6b12ceb878004e1351a9b6c |
|
BLAKE2b-256 | 329a08cb963d248db7ae006965b0dbd24b28a6ac0320ca2acff203a6677e3dbf |
Hashes for indexed_bzip2-1.0.0-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03a5b2f688f96bc1b6c9e7ffe5e1ad14044b0c1cb9cca94be2908be6ffdadf2d |
|
MD5 | 97bd7a939568cf0615a5fee5b0948377 |
|
BLAKE2b-256 | 73f473b52755deb13100f5b035c66510ec6928b2f193e32c11e73a3f65081e08 |
Hashes for indexed_bzip2-1.0.0-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 74564cff0518f2d88dd586116921a80b90a9cb96750c01f1fe9ace567388e66c |
|
MD5 | a0560951a51e123762e901f30fdcfc8d |
|
BLAKE2b-256 | 6b388868d15193f376b6cc011611d554aaa9a151054e457b6c4f1002f7ac4226 |
Hashes for indexed_bzip2-1.0.0-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48a706fd9222442c0a1536ea379c2005afe0006b04ba88c5a3529d6d3ebd882e |
|
MD5 | 9aaad41115a351d216c36775d7875f35 |
|
BLAKE2b-256 | 346f887b9c14e2676a25ce9360c23762cd755d885174c821779813a10d5340ae |
Hashes for indexed_bzip2-1.0.0-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b71b009963d3aacbbe40a1d16d455b2ceed0efec70a82c4a51ac944c47a52e8 |
|
MD5 | 6146230aac89dae4c3f50f79c33cf4e1 |
|
BLAKE2b-256 | 6c3a7daf77a00e68efba0c8cc6fec059970c5ba022110a0da5c1c145896f2381 |
Hashes for indexed_bzip2-1.0.0-cp34-cp34m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1702f0b2e6b7447f905ad98dc29747a67f87ca91afec1135e0d7b4fa24f78db9 |
|
MD5 | 89170006d863ca85a29db59e58326da8 |
|
BLAKE2b-256 | 83b952eea8f863f7cbd32e5e101dd03d742b4973b80bf884b31ede5577f303b2 |
Hashes for indexed_bzip2-1.0.0-cp34-cp34m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0185f5fc74adc926e72140d984198c1d8b5f0abd87681e65ac53628b7874019 |
|
MD5 | 121953b921c8ef6347955d5d70bd05f7 |
|
BLAKE2b-256 | 1ed9dcb8a236d1083068c241bf3d66218d5da3da3962c4e5c9698dc4773c03b3 |
Hashes for indexed_bzip2-1.0.0-cp34-cp34m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 561989f9bbf5f868074d67ec9a2dfa75248aacfb3e3e2114b9771b6aa53cebdc |
|
MD5 | 1dc1f3764651d31576e932f547d980fc |
|
BLAKE2b-256 | 8e620342b511bba18ee493517e7c635aa4144755e556693101c44e09dc279749 |