Reading the Central Directory First
A ZIP ends with an end-of-central-directory record, signature 0x06054b50, then an optional comment of up to 65,535 bytes. Scanning backwards for that signature gives the offset and count of the central directory, whose entries carry filenames, compression methods, CRC-32 values and local header offsets. Listing a 4 GB archive costs a few kilobytes of reads, not a full decompression.
ZIP64 moves the authoritative counts into a separate record when sizes or entry counts overflow 32 bits. Data descriptors, flagged by bit 3 of the general-purpose field, put sizes after the compressed data, which is why streaming writers can emit a local header before knowing the payload length. The central directory remains the reliable index.