What exactly happens when a ZIP file is extracted?

73 viewsOtherTechnology

I know the structure of a ZIP file, but how does a computer go about reassembling it into a directory? I’m not asking about compression algorithms, what I mean is in what order does it decompress the files, and in what order does it write them to storage?

In: Technology

4 Answers

Anonymous 0 Comments

There is no required or even recommended order. The decoder program can decompress files in any order it sees fit. On a multicore CPU, it can even decompress several files at the same time. ZIP format documentation also doesn’t say if a file should be written as a single unit, or if it can be written in chunks as the decompression progresses – this decision is also left for the decoder.

However, if the decoder program doesn’t do anything fancy, it is likely to use one of two orders: either it will decompress files in the order they appear in the main area of the ZIP, or (most likely) in the order they appear in the Central Directory section in the end of the ZIP.

The files are most likely written in chunks of few kB – which means you can observe partially written files when decompression is in progress.

You are viewing 1 out of 4 answers, click here to view all answers.