对标准zipfile模块进行猴子补丁以启用DCL Implode支持
项目描述
zipfile-dclimplode
对标准zipfile
模块进行猴子补丁以启用DCL Implode支持。
DCL代表PKWARE(R) 数据压缩库
。
基于zipfile-deflate64
和zipfile-zstandard
,它们提供了类似的功能,但用于deflate64
算法。与zipfile-deflate64
不同,此软件包支持压缩和解压缩。
需要dclimplode
进行dclimplode绑定。
注意:如果您需要Python2,请使用zipfile39代替(它也与Python3兼容)。
安装
pip install zipfile-dclimplode
使用
Python代码库的任何位置
import zipfile_dclimplode # This has the side effect of patching the zipfile module to support DCL Implode
或者,zipfile_dclimplode
重新导出zipfile
API,以便方便使用
import zipfile_dclimplode as zipfile
zipfile.ZipFile(...)
压缩示例
import zipfile_dclimplode as zipfile
zf = zipfile.ZipFile('/tmp/test.zip', 'w', zipfile.ZIP_DCLIMPLODED, compresslevel=3)
zf.write('large_file.img')
压缩级别:1,2,3(二进制)11,12,13(ASCII)