Home Forums .NET libraries Xceed Zip & Real-Time Zip for .NET How do Zip archives become corrupted?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #19662 |

    I’m exploring using the Zip archive / filesystem as the basis for my application. Before I jump off the deep end, I was hoping that folks could enumerate how / why zip files become corrupted, and what strategies might best be employed in order to provide the end-user the best possible assurance that their documents won’t disappear into a corrupted zip archive.

    Thanks for the responses!

    Imported from legacy forums. Posted by Shmuel (had 2428 views)

    Odi [Xceed]
    Spectator
    Post count: 426

    With a good quality Zip compression library (or time-tested Zip apps like WinZip and PKZip), normal manipulation of Zip files (adding, updating, deleting files in the Zip file) does not cause them to become corrupted. Some Zip components / libraries (especially the ones requiring you to understand about the headers and central directory in order to get basic tasks done) may introduce discrepancies between local headers and central directory headers, which may cause warnings and errors, but not necessarily loss of data.

    In the good old days, Zip files became corrupted from things like floppy disk errors or communications problems such as bad Xmodem / Zmodem file transfers. This can still happen, but is less likely, except from user errors such as transfering a Zip file through FTP but forgetting to do it in binary mode instead of ASCII mode. But in that case, the entire Zip file is pretty much useless. Writing the file to a CD-ROM disk may still produce errors – I know that I still have to check the [x] Verify Data option when burning to disk because sometimes it is indeed corrupted.

    In any case, the 32-bit CRC checksum inside a Zip file is there for detecting errors and our .NET Zip library lets you extract to streams (whose data you can discard and not fill up memory), which can be used for verifying if any data in the Zip file is corrupted (extracting everything with no errors means all the CRCs checked out).

    So if you don’t want documents to dissapear into a corrupted Zip file, you’ll have to test the Zip file before writing to it. There’s no quicker way to test the Zip file that is reliable (such as listing the contents of the zip file and checking if there were errors).

    Imported from legacy forums. Posted by Odi [Xceed] (had 3040 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.