pub struct Metadata {
pub data_offset: u64,
pub compressed_size: u64,
pub uncompressed_size: u64,
pub compression_method: CompressionMethod,
pub crc32: u32,
pub file_type: FileType,
pub unix_mode: u32,
pub modification_time: Option<Timestamp>,
pub access_time: Option<Timestamp>,
pub creation_time: Option<Timestamp>,
pub encryption: Option<EncryptionMethod>,
/* private fields */
}Expand description
The metadata of a ZIP entry.
Fields§
§data_offset: u64§compressed_size: u64§uncompressed_size: u64§compression_method: CompressionMethod§crc32: u32§file_type: FileType§unix_mode: u32Unix permissions for this file. Only the first 12 bits is exposed, which
matches the 0o7777 mask. May be 0 if unspecified.
Warning: When using this value on a real filesystem, make sure that
the sticky bit and the set-user-ID bit match what you expect.
These special bits are ignored by the extract method family.
modification_time: Option<Timestamp>§access_time: Option<Timestamp>§creation_time: Option<Timestamp>§encryption: Option<EncryptionMethod>Implementations§
Source§impl Metadata
impl Metadata
Sourcepub fn is_encrypted(&self) -> bool
pub fn is_encrypted(&self) -> bool
Returns true if this file is encrypted.
Sourcepub fn read<R: BufRead + Seek>(&self, reader: R) -> Result<impl Read + use<R>>
pub fn read<R: BufRead + Seek>(&self, reader: R) -> Result<impl Read + use<R>>
Returns a reader with the content of the file.
Unsupported compression methods and encrypted files will return an error.
Sourcepub fn read_stored<R: Read + Seek>(&self, reader: R) -> Result<Take<R>>
pub fn read_stored<R: Read + Seek>(&self, reader: R) -> Result<Take<R>>
Returns a reader with the content of the file.
Errors if the file is compressed, encrypted or corrupted. Is is not
necessary to use Metadata::content_checker on the result.
It is useful if you know that the file is stored as-is and you want to
take advantage of the BufReader or the Seek implementation.
Sourcepub fn read_raw<R: Read + Seek>(&self, reader: R) -> Result<Take<R>>
pub fn read_raw<R: Read + Seek>(&self, reader: R) -> Result<Take<R>>
Returns a reader with the raw, uncompressed, content of the file.
The uncompressed content should be checked with content_checker.
Sourcepub fn content_checker<R: Read>(&self, reader: R) -> impl Read + use<R>
pub fn content_checker<R: Read>(&self, reader: R) -> impl Read + use<R>
Wraps a reader to check that its content matches this metadata.
It is particularly useful in combinaison of read_raw.