logo
0
0
WeChat Login

libacg-7zip

Python 7-Zip 封装库,支持 ZIP/RAR/7Z 解压、密码处理、文件过滤,跨平台自动安装。

安装

pip install libacg-7zip

要求:Python >= 3.14,支持 Windows/Linux/macOS

快速开始

from libacg_7zip import Lib7Zip lib7z = Lib7Zip() # 基础解压 lib7z.extract("archive.zip", "output_dir") # 带密码解压 lib7z.extract("encrypted.7z", "output", password="secret") # 文件过滤 lib7z.extract("archive.zip", "output", include=["*.txt", "*.md"]) # 统计文件数量 files, folders = lib7z.check_filecounts("archive.rar")

主要特性

特性说明
多格式支持ZIP、RAR、7Z 解压与文件统计
密码处理支持加密压缩包解压
文件过滤include/exclude 模式精确控制
自动安装检测并自动下载 7-Zip
跨平台Windows/Linux/macOS,amd64/arm

常用参数

Lib7Zip( password="...", # 默认密码 include=["*.txt"], # 包含文件 exclude=["*.log"], # 排除文件 recursive_include=True, # 递归匹配 overwrite_mode="-aoa", # 覆盖模式: -aoa/-aos/-aou/-aot )

异常类型

  • ExtToolNotFound - 未找到 7-Zip
  • ExtToolError - 执行失败
  • DownloadError - 下载失败
  • ExtractError - 解压失败

如何贡献

参见 LibACG 贡献指南

许可证

MIT License

About

LibACG Tool Plugin - 7-Zip 压缩封装,支持 ZIP/RAR/7Z 等格式

Language
Python100%