I have to handle huge files, some of them > 14 GB. The files can be binary data or zip files (user can freely choose file extension). So we wrote a function, that checks, if we have a valid file that could be used in our application. Everything works fine, even with huge files. As far as I could see, the only object method of CkZip to check, if it is a valid zip file is OpenZip('....'). If you call the method, it needs a very long time to come back with the result.
If you use Windows ShellZip in the explorer, you can see in realtime, if the zip is invalid. Is there a fast way to do that with CkZip?
You probably can open the file in binary mode and look at the headers: http://en.wikipedia.org/wiki/Zip_%28file_format%29#Structure
It depends what you mean by "valid" Zip archive. There are three different levels of checking:
1) As Gert suggested, examine the initial headers to see if the file format is Zip. If so, you haven't verified that the zip is actually valid, but only that it is a file having the zip file format.
2) Call OpenZip to open and "walk" all of the zip file and central directory headers. This verifies that the zip headers are consistent and have no errors. However, it doesn't completely verify that the zip is 100% valid because each file could very well have corrupted compressed data.
3) A full unzip is the only way to 100% verify that the entire zip, including compressed data, is valid.
Thank you very much! I decided to use a combination of both. First I check for the typical signature in the Chilkat ZIP file then, if signature has been found, call OpenZip(). Ultrafast and exactly what I need!