login about faq

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?

asked Jan 26 '13 at 08:37

Istvan_Szabo's gravatar image

Istvan_Szabo
31112


You probably can open the file in binary mode and look at the headers: http://en.wikipedia.org/wiki/Zip_%28file_format%29#Structure

link

answered Jan 26 '13 at 18:37

Gert's gravatar image

Gert ♦
629141824

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.

link

answered Jan 28 '13 at 09:18

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

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!

link

answered Jan 28 '13 at 10:59

Istvan_Szabo's gravatar image

Istvan_Szabo
31112

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×87
×20
×8
×1
×1

Asked: Jan 26 '13 at 08:37

Seen: 4,293 times

Last updated: Jan 28 '13 at 10:59

powered by OSQA