runzip
A Rust unzip utility with HTTP URL support using Range requests.
Features
- Extract ZIP files from local filesystem
- Extract ZIP files from HTTP/HTTPS URLs using Range requests
- Only download the parts you need - perfect for large remote archives
- Support for ZIP64 format (archives larger than 4GB)
- Support for STORED and DEFLATE compression methods
- Familiar
unzip-like command line interface - Cross-platform (Linux, macOS, Windows)
Installation
From crates.io
From source
Usage
Basic usage
# Extract all files from a local ZIP
# Extract all files from a remote ZIP (only downloads needed parts!)
# Extract to a specific directory
# Extract specific files
# Extract files matching a pattern
List archive contents
# List files (simple)
# List files with details (size, compression ratio, date)
# List remote archive (minimal download)
Advanced options
# Extract to stdout (pipe mode)
|
# Exclude files
# Overwrite existing files without prompting
# Never overwrite existing files
# Junk paths (extract all files to current directory, ignore paths)
# Quiet mode
Command Line Options
Usage: runzip [OPTIONS] <FILE> [FILES]...
Arguments:
<FILE> ZIP file path or HTTP URL
[FILES]... Files to extract (default: all)
Options:
-l List files (short format)
-v List verbosely/show version info
-p Extract files to pipe, no messages
-d <DIR> Extract files into directory
-x <FILE>... Exclude files that match patterns
-n Never overwrite existing files
-o Overwrite files WITHOUT prompting
-j Junk paths (do not make directories)
-q Quiet mode (-qq => quieter)
-h, --help Print help
-V, --version Print version
How It Works
HTTP Range Requests
When extracting from an HTTP URL, runzip uses HTTP Range requests to download only the necessary parts of the archive:
- HEAD request - Get file size and verify Range support
- Read EOCD - Download the last ~64KB to find the End of Central Directory
- Read Central Directory - Download the file listing
- Extract files - Download only the specific file data needed
This means you can extract a single 1KB file from a 10GB remote archive by downloading only a few kilobytes!
ZIP Format Support
| Feature | Status |
|---|---|
| Standard ZIP | Supported |
| ZIP64 (>4GB) | Supported |
| STORED (no compression) | Supported |
| DEFLATE compression | Supported |
| Encryption | Not supported |
| BZIP2, LZMA, etc. | Not supported |
| Multi-disk archives | Not supported |
Library Usage
runzip can also be used as a library:
use Arc;
use ;
async
Performance
When working with remote archives, runzip is highly efficient:
| Operation | Data Downloaded |
|---|---|
| List files | ~64KB + Central Directory size |
| Extract one file | List + file's compressed size |
| Extract all files | Full archive |
For local files, runzip uses platform-optimized I/O:
- Unix:
pread()for atomic positioned reads - Windows: Handle duplication for thread-safe reads
License
MIT License - see LICENSE for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.