Question

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?

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top