Skip to main content

ZipArchive

Struct ZipArchive 

Source
pub struct ZipArchive<R> { /* private fields */ }
Expand description

A parsed ZIP archive over a seekable reader.

Implementations§

Source§

impl<R: Read + Seek> ZipArchive<R>

Source

pub fn new(reader: R) -> Result<Self, ZipCoreError>

Parse the EOCD and central directory of reader.

Source

pub fn summary(&self) -> &ArchiveSummary

Container-level offsets/counts for structural audits.

Source

pub fn len(&self) -> usize

Number of entries in the central directory.

Source

pub fn is_empty(&self) -> bool

Whether the archive has no entries.

Source

pub fn file_names(&self) -> impl Iterator<Item = &str>

Iterate entry names in central-directory order.

Source

pub fn by_index(&mut self, i: usize) -> Result<ZipFile<'_>, ZipCoreError>

Open the entry at index i for decoding (mirrors zip-rs by_index).

Source

pub fn by_name(&mut self, name: &str) -> Result<ZipFile<'_>, ZipCoreError>

Open the named entry for decoding (mirrors zip-rs by_name).

Source

pub fn by_index_decrypt( &mut self, i: usize, password: &[u8], ) -> Result<ZipFile<'_>, ZipCoreError>

Open the entry at index i, decrypting it with password (ZipCrypto or WinZip AES). Errors with WrongPassword if the password fails the check.

Source

pub fn by_name_decrypt( &mut self, name: &str, password: &[u8], ) -> Result<ZipFile<'_>, ZipCoreError>

Open the named entry, decrypting it with password.

Source

pub fn structural_view(&mut self) -> Result<Vec<EntryLayout>, ZipCoreError>

Raw structural view for the forensic analyzer: per entry, the header fields as recorded in BOTH the central directory and the local file header, plus offsets. This is the seam that lets zip-forensic compare the two copies (tamper signal) without re-implementing a second parser.

Auto Trait Implementations§

§

impl<R> Freeze for ZipArchive<R>
where R: Freeze,

§

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> UnsafeUnpin for ZipArchive<R>
where R: UnsafeUnpin,

§

impl<R> UnwindSafe for ZipArchive<R>
where R: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.