kolistivra
kolistivra

Reputation: 4429

Should all file structures in a ZIP file be consecutive?

While reading a ZIP file, can we safely assume that all file structures (by that I mean Local File Header + file data (compressed or stored) + Data Descriptor) are exactly consecutive? Can there be any irrelevant data in between?

Upvotes: 0

Views: 41

Answers (1)

Nickolay Olshevsky
Nickolay Olshevsky

Reputation: 14160

PkWare Appnote tells that

"Immediately following the local header for a file is the compressed or stored data for the file. The series of [local file header][file data][data descriptor] repeats for each file in the .ZIP archive."

So there should be no gaps between them.

However, I would recommend to parse and read central directory, not go through local file headers (except that you need streamed processing).

Upvotes: 2

Related Questions