Rust crates for ZIP structures (zip_structs)

CI (master) CI (Release) zip<em>structs at crates.io zip</em>structs at docs.rs

This crates handles structures in ZIP files.

Installation

Add the following line to [dependencies] in your Cargo.toml.

toml zip_structs = "^0.1"

Breaking changes to the API are planned for the future. Therefore, it is strongly recommended to use this versioning format.

Basic usage of parsing from the EOCD sturcture of a ZIP archive

```rust use std::io::BufReader; use std::fs::File; use oemcp::decodestringcompletetable; use oemcp::codetable::DECODINGTABLECP437;

use zipstructs::zipcentraldirectory::ZipCDEntry; use zipstructs::zipeocd::ZipEOCD; use zipstructs::ziplocalfile_header::ZipLocalFileHeader;

let mut zip_file = BufReader(File::open("path/to/archive.zip")?);

let eocd = ZipEOCD::fromreader(&mut zipfile)?; let cdlist = ZipCDEntry::allfromeocd(&mut zipfile, &eocd)?;

// Show file names in the ZIP archive for cd in &cdlist { println!( "{}", if cd.isencodedinutf8() { String::fromutf8lossy(&cd.filenameraw); } else { decodestringcompletetable(&cd.filenameraw, DECODINGTABLECP437) } ); let localfileheader = ZipLocalFileHeader::fromcentraldirectory(&mut zipfile, &cd)?; dosomething(&localfile_header); } ```

Competing libraries

There are some libraries providing more abstract and higher-level APIs.

These libraries do not handle general purpose bit flags in central directories and local file headers. rc-zip cannot handle file names encoded in other than UTF-8.

This library provides virtual file system, not structures in ZIP archives.

Support of ZIP64

This library has not supported ZIP64 yet.

License

MIT

See LICENSE