Struct zip::read::ZipArchive [−][src]
pub struct ZipArchive<R> { /* fields omitted */ }
Expand description
ZIP archive reader
use std::io::prelude::*; fn list_zip_contents(reader: impl Read + Seek) -> zip::result::ZipResult<()> { let mut zip = zip::ZipArchive::new(reader)?; for i in 0..zip.len() { let mut file = zip.by_index(i)?; println!("Filename: {}", file.name()); std::io::copy(&mut file, &mut std::io::stdout()); } Ok(()) }
Implementations
Read a ZIP archive, collecting the files it contains
This uses the central directory record of the ZIP file, and ignores local file headers
Extract a Zip archive into a directory, overwriting files if they
already exist. Paths are sanitized with ZipFile::enclosed_name
.
Extraction is not atomic; If an error is encountered, some of the files may be left on disk.
Get the offset from the beginning of the underlying reader that this zip begins at, in bytes.
Normally this value is zero, but if the zip has arbitrary data prepended to it, then this value will be the size of that prepended data.
Returns an iterator over all the file and directory names in this archive.
pub fn by_name_decrypt<'a>(
&'a mut self,
name: &str,
password: &[u8]
) -> ZipResult<Result<ZipFile<'a>, InvalidPassword>>
[src]
pub fn by_name_decrypt<'a>(
&'a mut self,
name: &str,
password: &[u8]
) -> ZipResult<Result<ZipFile<'a>, InvalidPassword>>
[src]Search for a file entry by name, decrypt with given password
Search for a file entry by name
pub fn by_index_decrypt<'a>(
&'a mut self,
file_number: usize,
password: &[u8]
) -> ZipResult<Result<ZipFile<'a>, InvalidPassword>>
[src]
pub fn by_index_decrypt<'a>(
&'a mut self,
file_number: usize,
password: &[u8]
) -> ZipResult<Result<ZipFile<'a>, InvalidPassword>>
[src]Get a contained file by index, decrypt with given password
Get a contained file by index
Get a contained file by index without decompressing it
Unwrap and return the inner reader object
The position of the reader is undefined.
Trait Implementations
Auto Trait Implementations
impl<R> RefUnwindSafe for ZipArchive<R> where
R: RefUnwindSafe,
impl<R> Send for ZipArchive<R> where
R: Send,
impl<R> Sync for ZipArchive<R> where
R: Sync,
impl<R> Unpin for ZipArchive<R> where
R: Unpin,
impl<R> UnwindSafe for ZipArchive<R> where
R: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more