索引lzo压缩文件的库
python3-lzo-indexer的Python项目详细描述
Python库,用于索引LZO压缩文件中的块偏移量。 实现主要基于Hadoop Library。 索引文件用于允许hadoop拆分压缩的单个文件 将lzo分成几个块进行并行处理。
由于lzo是一种基于块的压缩算法,我们可以分割文件 沿着一排一排的积木,将每个积木单独减压。这个 索引是包含原始块中每个块的字节偏移量的文件 LZO文件。
这个库是python-lzo-indexer的python3 fork。
示例
下面的python代码演示了为lzo文件编制索引是多么容易。 此库还支持对字符串进行索引,以及返回 如果需要创建自己的文件,则需要单独的块偏移 格式。
importlzo_indexerwithopen("my-file.lzo","r")asf,open("my-file.lzo.index","rw")asindex:lzo_indexer.index_lzo_file(f,index)
命令行实用程序
这个库还包括一个用于索引多个多字节文件的实用程序, 使用python索引器。这是比 命令行实用程序内置在hadoop lzo库中,因为它避免了 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.
贡献
我欢迎任何贡献,尽管我要求任何请求 提供测试覆盖率。