#zip #archive #extract

zip-extract

Archive extraction via zip-rs, automated

2 releases

0.1.1 Jan 26, 2022
0.1.0 Jun 22, 2020

#125 in Compression

Download history 221/week @ 2022-10-05 288/week @ 2022-10-12 393/week @ 2022-10-19 316/week @ 2022-10-26 411/week @ 2022-11-02 707/week @ 2022-11-09 581/week @ 2022-11-16 518/week @ 2022-11-23 538/week @ 2022-11-30 479/week @ 2022-12-07 300/week @ 2022-12-14 409/week @ 2022-12-21 337/week @ 2022-12-28 442/week @ 2023-01-04 553/week @ 2023-01-11 639/week @ 2023-01-18

2,012 downloads per month
Used in 13 crates (8 directly)

MIT license

170KB
114 lines

zip-extract

CI Crates.io Docs.rs

zip-extract's primary goal is simple: Automate tedious zip extraction. Ever wanted to just unpack an archive somewhere? Well, here you go.

Usage

let archive: Vec<u8> = download_my_archive()?;
let target_dir = PathBuf::from("my_target_dir"); // Doesn't need to exist

// The third parameter allows you to strip away toplevel directories.
// If `archive` contained a single directory, its contents would be extracted instead.
zip_extract::extract(Cursor::new(archive), &target_dir, true)?;

Features

All features are passed through to zip and flate2. They are:

  • deflate: Support for the Deflate algorithm (miniz_oxide rust-backend)
  • deflate-miniz: ^ dito (miniz C-backend)
  • deflate-zlib: ^ dito (zlib C-backend)
  • bzip2: Support for .bzip2 archives via the bzip2 crate

The default is bzip2 and deflate.

Dependencies

~1.7–3MB
~52K SLoC