下载和提取存档的常用工具
项目描述
downloadutil
一个Python模块,包含下载和提取存档的常用工具。
用例
- 从URL下载存档以及从同一URL(添加".sha256"后缀)下载预期的SHA256校验和。验证校验和。
- 如上所述下载存档并将其提取到目标目录,同时仍保留存档在特殊缓存目录中。
作为命令行工具使用
作为 downloadutil
或 python3 -m downloadutil
调用。
usage: downloadutil [-h] --url URL [--dest-dir-parent DEST_DIR_PARENT] [--cache-dir CACHE_DIR] [--no-cache] [--verify-checksum] [--verbose]
options:
-h, --help show this help message and exit
--url URL URL to download.
--dest-dir-parent DEST_DIR_PARENT
Parent directory in which to extract the archive
--cache-dir CACHE_DIR
Download cache directory on the locally mounted disk. Must have enough space.
--no-cache Do not use a cache directory
--verify-checksum In addition to downloading the given URL, also download the SHA256 checksum file from the URL obtained by appending an .sha256 suffix, and verifying the checksum.
--verbose Verbose logging