I use CkZip C++ v22.214.171.124 in an application that runs on Windows. This application uses CkZip to store large numbers of small jpg files, so no compression.
Performance is important and so I have always used QuickAppend when adding new files to existing zip archives.
I am finding that when we use QuickAppend to add a small file (for example 2KB) file to a zip containing many (for example several thousand) similar small files, the file grows by an amount significantly larger than the added file.
I believe what is happening is that the central directory at the end of the existing zip file is large due to the high count of files in the zip. When the central directory is larger than the data being added, the new data only partially overwrites the old central directory. The new central directory is then appended to the end of the zip, leaving a large remnant of the old central directory. This repeats for each new added file, compounding the problem. We are seeing zip files that are 3 or 4 times larger than all the constituent files. This is bad for us because one of the reasons for using zip is to efficiently pack the files for optimal file-system storage.
If I have understood the problem correctly, is it possible to make QuickAppend add the new central directory to the end of the new file entry segment rather than at the end of the file? When adding a new file, the new central directory will always be larger than the previous one, ensuring that the old data is completely over-written, leaving the end of central directory record correctly at the end of the file.
Has anyone else seen this problem and found a solution?
I can supply an example zip file showing the problem if needed.
asked Sep 01 at 23:08
Here's a new build:
answered Sep 02 at 08:07
This was already fixed. Please let me know the exact build you need (MSVC++ version) or other operating system, and I will upload the latest pre-release tomorrow.
answered Sep 01 at 23:26