pub struct ZipArchive<'a> { /* private fields */ }
Expand description

A ZIP archive to be read

Implementations

Reads a ZIP archive from a byte slice. Smaller files can be read into a buffer.

let bytes = fs::read("foo.zip")?;
let archive = ZipArchive::new(&bytes)?;

For larger ones, memory map!

let zip_file = File::open("foo.zip")?;
let mapping = unsafe { Mmap::map(&zip_file)? };
let archive = ZipArchive::new(&mapping)?;

Like ZipArchive::new(), but allows arbitrary data to prepend the archive. Returns the ZipArchive and the number of bytes prepended to the archive.

Since a ZIP archive’s metadata sits at the back of the file, many formats consist of ZIP archives prepended with some other data. For example, a self-extracting archive is one with an executable in the front.

Returns the entries found in the ZIP archive’s central directory.

No effort is made to deduplicate or otherwise validate these entries. To do that, create a FileTree.

Reads the given file from the ZIP archive.

Since each file in a ZIP archive is compressed independently, multiple files can be read in parallel.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.