Git Product home page Git Product logo

Comments (5)

EvanOxfeld avatar EvanOxfeld commented on August 15, 2024

So in some cases the Central Directory File Header includes the compressed and uncompressed sizes of the files in the zip file? If you're able, can you send a link to an example zip file, or can you suggest a free tool that creates this type of zip?

from node-unzip.

rwaldin avatar rwaldin commented on August 15, 2024

Here's an example created with the java jar command line tool: http://cl.ly/0E3S0A2o0D2b/test.zip

I think this is the same problem. Local file header has 0 as compressed and uncompressed sizes. Central Directory File Header has the actual sizes.

from node-unzip.

rwaldin avatar rwaldin commented on August 15, 2024

Interestingly, the pullstream.pipe() to Inflater deflates the first entry, but never emits the 'end' event. Instead it loops indefinitely processing zero bytes. I think this can be made to work without having to read the central directory data at the end of the stream if that condition that causes it to loop indefinitely can instead be detected and trigger the 'end' event.

from node-unzip.

matthiasg avatar matthiasg commented on August 15, 2024

the parser always parsed front to back which does not work with the case of bit 3 set
as defined in http://www.pkware.com/documents/casestudies/APPNOTE.TXT

   4.4.4 general purpose bit flag: (2 bytes)

   ...

    Bit 3: If this bit is set, the fields crc-32, compressed 
           size and uncompressed size are set to zero in the 
           local header.  The correct values are put in the 
           data descriptor immediately following the compressed
           data.  (Note: PKZIP version 2.04g for DOS only 
           recognizes this bit for method 8 compression, newer 
           versions of PKZIP recognize this bit for any 
           compression method.)

i would assume it might work to just read the directory once into memory and then reading forward through the file.

is somebody working on this or do we need to fork ?

from node-unzip.

mfncooper avatar mfncooper commented on August 15, 2024

@EvanOxfeld The Archive Utility in Mac OS X writes zip archives this way by default, I believe, as do most streaming implementations, since they can write the Local File Header without knowing the compressed size ahead of time. If you're creating large zip archives, or archives containing large files, it's pretty much the only way to go.

@matthiasg I had enough trouble finding robust bi-directional zip archive support, and needed it for a production system, so I ended up writing my own. It's not open source yet, but should be soon.

from node-unzip.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.