Created
November 22, 2022 15:34
-
-
Save adetaylor/61f04ec040cd1d5af2e8ba760ffd5fbf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use anyhow::Result; | |
use clap::Parser; | |
use std::fs::File; | |
/// Unzip all files within a zip file as quickly as possible. | |
#[derive(Parser, Debug)] | |
#[command(author, version, about, long_about = None)] | |
struct Args { | |
/// Zip file to unzip | |
#[arg(value_name = "FILE")] | |
zipfile: PathBuf, | |
} | |
fn main() -> Result<()> { | |
let args = Args::parse(); | |
let zipfile = File::open(args.zipfile)?; | |
let zip = zip::ZipArchive::new(zipfile)?; | |
let file_count = zip.len(); | |
println!("Zip has {} files", file_count); | |
Ok(()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment