Skip to main content

read_package

Function read_package 

Source
pub fn read_package(bytes: &[u8]) -> OgeomResult<Vec<(String, Vec<u8>)>>
Expand description

Read every part of a package: the entry names and their bytes.

Stored and deflated entries are read, each checked against its checksum, from classic and ZIP64 archives alike; the central directory’s sizes are the ones trusted, since a streamed entry’s local header leaves them zero or saturated. Any other compression method, an encrypted entry, entries that overlap one another, or an archive spanning several disks is refused by name rather than half-read.

Every entry is held in memory at once, so the package is held to PackageLimits::default: read_package_within reads one under other limits, or PackageLimits::NONE.

§Errors

OgeomError::Construction if the bytes are not a ZIP archive, an entry is damaged, it is one of the refusals above, or it is past the default limits.