This crates handles structures in ZIP files.
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.
```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); } ```
There are some libraries providing more abstract and higher-level APIs.
zip
rc-zip
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.
vfs-zip
This library provides virtual file system, not structures in ZIP archives.
This library has not supported ZIP64 yet.
MIT