The format of the zip file ends with a central section of the directory, which then points to individual zip entries in the file. It seems that zip records occur anywhere in the zip file itself. Indeed, self-extracting zip files are a good example: they start with an executable file, and all zip entries appear after executable bytes.
The question is: does the zip file format really allow or disjoint zip records? , eg. if there are empty or unaccounted bytes between zip entries? Both the final PK publication and the wikipedia article seem to allow this. Will all / most typical zip utilities work with such sparse zip files?
Usage example: I want to be able to delete or replace zip entries in a zip file. For this, typical mini-libraries, etc. Libraries want you to copy the entire zip file without copying the deleted or replaced zip record, which seems wasteful and slow.
Wouldn’t it be better to reallocate, say, 1.5 x storage for the record, and then when deleting or replacing the record, could you determine where the unallocated bytes were and use them directly? Using 1.5x means that if the zip record grew linearly, the redistribution should also occur with linear depreciation. It will be similar to file system block allocation, although it is probably not that difficult.
It also helps with a lot of zip-based file formats. Instead of having some kind of temporary directory somewhere (or even in memory) with temporary unpacked files for editing / editing, and then for reinstalling the batch in the file format, this will reduce the need for redistributing and rewriting parts of the zip file.
Are there any C / C ++ libraries that do this?
source
share