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>
impl<'a> CompressedZipFile<'a>
pub fn compressed_contents(&self) -> &[u8] ⓘ
Sourcepub fn write_with_limit(
&self,
w: &mut dyn Write,
limit: Option<usize>,
) -> Result<(), ZipParseError>
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.
Sourcepub fn write(&self, w: &mut dyn Write) -> Result<(), ZipParseError>
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.
Sourcepub fn decompressed_contents_with_limit(
&self,
limit: Option<usize>,
) -> Result<Cow<'_, [u8]>, ZipParseError>
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.
Sourcepub fn decompressed_contents(&self) -> Result<Cow<'_, [u8]>, ZipParseError>
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.
Sourcepub fn file_path(&self) -> &Path
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.
Sourcepub fn file_path_bytes(&self) -> &'a [u8] ⓘ
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.
Sourcepub fn compression_method(&self) -> CompressionMethod
pub fn compression_method(&self) -> CompressionMethod
The algorithm used to compress this file.
This is typically CompressionMethodName::None
or
CompressionMethodName::Deflate
.