#zip #archive #extract

zip-extract

Archive extraction via zip-rs, automated

1 unstable release

0.1.0 Jun 22, 2020

#161 in Compression

Download history 51/week @ 2021-10-01 46/week @ 2021-10-08 47/week @ 2021-10-15 67/week @ 2021-10-22 144/week @ 2021-10-29 31/week @ 2021-11-05 101/week @ 2021-11-12 75/week @ 2021-11-19 30/week @ 2021-11-26 49/week @ 2021-12-03 48/week @ 2021-12-10 34/week @ 2021-12-17 10/week @ 2021-12-24 119/week @ 2021-12-31 105/week @ 2022-01-07 71/week @ 2022-01-14

317 downloads per month
Used in 2 crates

MIT license

185KB
114 lines

zip-extract

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.


lib.rs:

zip-extract

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

Usage

See extract for details.

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 folder, that folder's 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.6–2.8MB
~51K SLoC

:^