Expand description
Strict ZIP record framing for asynchronous, seekable inputs.
The core API in this crate is Index, which can be built from a ZIP’s
central directory and used to access individual members (after reconciling
their central and local states).
Potentially relevant internals:
-
CentralDirectoryEntry,IndexedEntry, andEntryrepresent a refinement type hierarchy, i.e. they go from fewest invariants preserved (just parsing the central directory entry) to the most invariants preserved (a member whose central and local records have been checked for consistency). -
Filenames and UNIX extra-field link targets must be UTF-8.
-
zip-framing does not decode or validate member payloads. It exposes their offsets and compressed sizes so consumers can read and decode them, then verify their decoded sizes and CRC32s.
-
zip-framing assumes that the ZIP source does not change.
§ZIP compatibility
-
zip-framing rejects empty filenames, including unnamed members from standard input (APPNOTE 4.4.17.1).
-
Directory member names must end in
/so readers can identify their type from the filename alone. -
APPNOTE 4.4.17.1 requires forward slashes as path separators. By default, zip-framing rejects backslashes in member names. See
IndexPolicy::allow_backslashes. -
By default, zip-framing rejects stored members that use a data descriptor, since other streaming ZIP parsers frequently misinterpret them. See
IndexPolicy::allow_stored_data_descriptors. -
By default, zip-framing does not honor symlink mode bits unless the host system indicated by the “version made by” field indicates a UNIX host (3). See
IndexPolicy::allow_ambiguous_symlink_modes. -
zip-framing rejects members that have the “record-oriented” bit set in their internal file attributes (APPNOTE 4.4.14.2).
-
By default, zip-framing accepts only required ZIP64 extra fields (
0x0001). SeeExtraFieldPolicyfor options to accept other fields. Redundant local ZIP64 sizes require a separate opt-in throughIndexPolicy::allow_redundant_zip64_sizes. -
By default, each member header must declare at least the extraction version required by its features. See
IndexPolicy::allow_incompatible_extraction_versions. -
Timestamps may differ between headers and across formats. zip-framing accepts any packed DOS date and time and checks the layout of supported timestamp extras. It does not interpret or expose timestamp values.
-
Windows NT security descriptor extras (
0x4453) may appear in either header or both. zip-framing checks each layout independently and ignores the declared size and descriptor contents.
Modules§
- constants
- ZIP wire-format values shared by record parsing, serialization, and codecs.
- write
- Canonical UTF-8, single-volume ZIP64 record serialization.
Structs§
- Budget
- ZIP resource limits and cumulative metadata and uncompressed-size usage.
- Central
Directory Entry - Metadata retained from a member’s central directory entry.
- Comment
Policy - Which comments the reader accepts in member and end records.
- Device
Numbers - Device numbers from a PKWARE UNIX extra field.
- Entry
- A member whose local file entry, extras, and optional data descriptor have been reconciled with the directory and checked for a consistent kind.
- Extra
Header IdSet - A set of known ZIP extra-field identifiers for
ExtraFieldPolicy::AllowListed. - Index
- A ZIP member index.
- Index
Policy - Controls resource limits and compatibility when indexing a ZIP archive.
- Indexed
Entry - An indexed ZIP member and its central directory entry.
- Limits
- Limits applied when reading ZIP archives.
Enums§
- Budget
Error - A failed cumulative budget charge.
- Comment
Rule - Which ZIP comment bytes the reader accepts. Empty comments are always accepted.
- Compression
Method - A supported ZIP compression method.
- Entry
Kind - A ZIP member’s kind, determined from its reconciled metadata.
- Error
- A failure while reading or writing ZIP records.
- Extra
Field Policy - Which extra fields a reader accepts in local and central member headers.
- Extra
Header Id - A supported ZIP member extra-field identifier. The discriminant is the wire value.
- Host
System - The host-system interpretation of a ZIP member’s external attributes.
- Index
Policy Violation - A supported ZIP feature excluded by the selected
IndexPolicy. - Limit
Exceeded - A ZIP resource limit and its configured maximum.