| Crates.io | netzip |
| lib.rs | netzip |
| version | 0.1.0 |
| created_at | 2025-04-05 21:05:24.47109+00 |
| updated_at | 2025-04-05 21:05:24.47109+00 |
| description | A library for accessing files in remote ZIPs over HTTP without downloading the entire archive |
| homepage | |
| repository | https://github.com/sysrqmagician/netzip |
| max_upload_size | |
| id | 1622445 |
| size | 55,018 |
NetZip is a Rust library and CLI tool that allows you to work with remote ZIP files over HTTP without downloading the entire archive. It uses HTTP range requests to efficiently fetch only the parts of the ZIP file that are needed.
cargo install netzip_cli
git clone https://github.com/sysrqmagician/netzip.git
cd netzip
cargo build --release
The binary will be available at ./target/release/netzip_cli.
netzip list https://example.com/archive.zip
# or with the shorter alias
netzip l https://example.com/archive.zip
This will display a table with file paths, compressed sizes, and uncompressed sizes.
# Extract specific files
netzip extract https://example.com/archive.zip file1.txt file2.txt
# or with the shorter alias
netzip x https://example.com/archive.zip file1.txt file2.txt
Add to your Cargo.toml:
[dependencies]
netzip = "0.1.0"
reqwest = "0.12.15"
tokio = { version = "1.44.1", features = ["full"] }
use netzip::RemoteZip;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let url = "https://example.com/archive.zip";
let zip = RemoteZip::get(url).await?;
for record in zip.records() {
println!("{} - {} bytes", record.file_name, record.uncompressed_size);
}
Ok(())
}
use netzip::RemoteZip;
use std::fs;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let url = "https://example.com/archive.zip";
let zip = RemoteZip::get(url).await?;
let files_to_extract = vec!["file1.txt".to_string(), "file2.txt".to_string()];
let extracted_files = zip.download_files(files_to_extract).await?;
for (file, content) in extracted_files {
fs::write(&file.file_name, content)?;
println!("Extracted: {}", file.file_name);
}
Ok(())
}
NetZip uses a three-step process to efficiently access files in a remote ZIP archive:
This approach minimizes bandwidth usage, making it ideal for working with large ZIP files when you only need specific contents.
LGPLv3