Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • Can't you start scanning backwards from the end (ZIP directory is located at the end of file)? Commented Dec 21, 2011 at 18:13
  • 5
    Yes I can, but is this really the way you are supposed to do this? Scanning backwards to find the End of Central Directory is a possibility, but considering the fact that it has a variable-sized comment field of size 16-bits, you can have about 65k of comments that you need to read/scan through, and if the comment contains the magic number your scanning will fail. Commented Dec 21, 2011 at 18:51
  • comments are most always empty and what 64K is today? Commented Dec 22, 2011 at 5:26
  • 5
    I ended up doing it that way. 64k and the fact that no one is likely to introduce such bytes in the comments do not mean that it's okay to do it this way. Commented Dec 22, 2011 at 18:22
  • 1
    Fun Fact - Windows Explorer will not open zip files if they contain the end of directory signature in the zip file comment. WinRAR and 7z do not have this problem. Commented Mar 21, 2015 at 20:05