Struct CompressedZipFile

Source
pub struct CompressedZipFile<'a> {
    pub metadata: Metadata<'a>,
    /* private fields */
}
Expand description

A single compressed ZIP file

Fields§

§metadata: Metadata<'a>

Implementations§

Source§

impl<'a> CompressedZipFile<'a>

Source

pub fn compressed_contents(&self) -> &[u8]

Source

pub fn write_with_limit( &self, w: &mut dyn Write, limit: Option<usize>, ) -> Result<(), ZipParseError>

Efficiently writes decompressed contents to sink without loading full decompressed contents into memory

limit controls the max uncompressed file size that will be accepted. A limit of None implies no limit. Note that setting too high of a limit can make decoders susceptible to DoS through ZIP bombs or other means.

Source

pub fn write(&self, w: &mut dyn Write) -> Result<(), ZipParseError>

Efficiently writes decompressed contents to sink without loading full decompressed contents into memory.

This method uses the default limit of 8 gigabytes. See CompressedZipFile::write_with_limit to configure this limit.

Source

pub fn decompressed_contents_with_limit( &self, limit: Option<usize>, ) -> Result<Cow<'_, [u8]>, ZipParseError>

Decompress full contents into memory

limit controls the max uncompressed file size that will be accepted. A limit of None implies no limit. Note that setting too high of a limit can make decoders susceptible to DoS through ZIP bombs or other means.

Source

pub fn decompressed_contents(&self) -> Result<Cow<'_, [u8]>, ZipParseError>

Decompress full contents into memory

This method uses the default limit of 8 gigabytes. See CompressedZipFile::decompressed_contents_with_limit to configure this limit.

Source

pub fn file_path(&self) -> &Path

This file’s Path inside the ZIP archive.

Note that this path may reference file paths outside the archive through the use of absolute paths or the parent directory (..). The full file path should not be used when interacting with the host file system if the ZIP file is untrusted.

Source

pub fn file_path_bytes(&self) -> &'a [u8]

The raw bytes of this file’s path inside the ZIP archive.

Note that this path may reference file paths outside the archive through the use of absolute paths or the parent directory (..). The full file path should not be used when interacting with the host file system if the ZIP file is untrusted.

Source

pub fn compression_method(&self) -> CompressionMethod

The algorithm used to compress this file.

This is typically CompressionMethodName::None or CompressionMethodName::Deflate.

Trait Implementations§

Source§

impl<'a> Debug for CompressedZipFile<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for CompressedZipFile<'a>

§

impl<'a> RefUnwindSafe for CompressedZipFile<'a>

§

impl<'a> Send for CompressedZipFile<'a>

§

impl<'a> Sync for CompressedZipFile<'a>

§

impl<'a> Unpin for CompressedZipFile<'a>

§

impl<'a> UnwindSafe for CompressedZipFile<'a>

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, 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.