Packmatic.Field.Central.FileHeader (Packmatic v2.0.0)

View Source

Represents 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

SizeContent
4 bytesSignature
1 byteVersion made by - Zip Specification Version
1 byteVersion made by - Environment
2 bytesVersion needed to extract
2 bytesGeneral Purpose Flag
2 bytesCompression Method (0 = No Compression; 8 = Deflated)
2 bytesModification Time (DOS Format)
2 bytesModification Date (DOS Format)
4 bytesChecksum (CRC-32)
4 bytesCompressed Size (Placeholder to force Zip64)
4 bytesOriginal Size (Placeholder to force Zip64)
2 bytesFile Path Length (Bytes)
2 bytesExtra Fields Length (Bytes)
2 bytesFile Comment Length (Bytes)
2 bytesStarting Disk Number for File
2 bytesInternal Attrbutes
4 bytesExternal Attrbutes
4 bytesOffset of Local File Header (Placeholder to force Zip64)
VariableFile Path
VariableExtra Fields
VariableFile Comment

Notes

  1. 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.
  2. The Compressed Size and Original Size fields are both 4-byte fields, meaning the maximum value is 0xFF 0xFF 0xFF 0xFF in 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 by Packmatic.Field.Shared.ExtendedInformation.

  3. 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.

  4. The following Extra Fields are emitted:

  5. File comments are not emitted by Packmatic.

Summary

Types

t()

@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()
}