Packmatic.Field.Central.FileHeader (Packmatic v2.0.0)
View SourceRepresents the Central Directory File Header, which is part of the Central Directory at the end of the archive.
The Central Directory is emitted after all successfully encoded files have been incorporated into the Zip stream. It contains one Central Directory File Header for each encoded file and a single End of Central Directory record.
Structure
Central Directory File Header
| Size | Content |
|---|---|
| 4 bytes | Signature |
| 1 byte | Version made by - Zip Specification Version |
| 1 byte | Version made by - Environment |
| 2 bytes | Version needed to extract |
| 2 bytes | General Purpose Flag |
| 2 bytes | Compression Method (0 = No Compression; 8 = Deflated) |
| 2 bytes | Modification Time (DOS Format) |
| 2 bytes | Modification Date (DOS Format) |
| 4 bytes | Checksum (CRC-32) |
| 4 bytes | Compressed Size (Placeholder to force Zip64) |
| 4 bytes | Original Size (Placeholder to force Zip64) |
| 2 bytes | File Path Length (Bytes) |
| 2 bytes | Extra Fields Length (Bytes) |
| 2 bytes | File Comment Length (Bytes) |
| 2 bytes | Starting Disk Number for File |
| 2 bytes | Internal Attrbutes |
| 4 bytes | External Attrbutes |
| 4 bytes | Offset of Local File Header (Placeholder to force Zip64) |
| Variable | File Path |
| Variable | Extra Fields |
| Variable | File Comment |
Notes
The General Purpose Flag has the following bits set.
- Bit 3: Indicating a Streaming Archive; Data Descriptor is used, and the Local File Header has no Size or CRC information.
- Bit 11: Language encoding flag, indicating that the Filename and Comment are both already in UTF-8. As per APPNOTE, the presence of this flag obviates the need to emit a separate Info-ZIP Unicode Path Extra Field.
The Compressed Size and Original Size fields are both 4-byte fields, meaning the maximum value is
0xFF 0xFF 0xFF 0xFFin case of overflow, however we will not use these fields, because the Zip version 4.5 is already required, which implies that the client must support Zip64. The real sizes are always set again in the Zip64 Extended Information Extra Field, which uses 8-byte fields, as provided byPackmatic.Field.Shared.ExtendedInformation.If the Entry has both the UID and GID attributes set then this will be emitted in an Extra Field, otherwise said field will not be emitted.
The following Extra Fields are emitted:
- Extended Timestamp, see
Packmatic.Field.Shared.ExtendedTimestamp - Zip64 Extended Information, see
Packmatic.Field.Shared.ExtendedInformation - UNIX UID/GID Information, see
Packmatic.Field.Shared.Unix
- Extended Timestamp, see
File comments are not emitted by Packmatic.
Summary
Types
@type t() :: %Packmatic.Field.Central.FileHeader{ attributes: Packmatic.Manifest.Entry.Attributes.t(), checksum: non_neg_integer(), method: Packmatic.Manifest.Entry.method(), offset: non_neg_integer(), path: Path.t(), size: non_neg_integer(), size_compressed: non_neg_integer(), timestamp: DateTime.t() }