Description
I'd like to write a zip file decompressor in node. To do that, I'd need to be able to inflate a deflated stream without knowing it's length in advance (some zip files do not include the deflated stream's length until after the stream).
I'm not entirely sure, but I don't think node currently allows this. The popular npm unzip modules all search for a magic signature to find the end of the deflate stream. This is incorrect (per Mark Adler) as the magic signature might appear as compressed data in the deflate stream itself. I've linked to some of those examples in the SO discussion with Mark Adler on SO here.
I think node strives to expose the deflate logic as a stream transform. A stream transform expects to to consume each of the data chunks passed to it. So there's no way, via that abstraction, to have the stream self report it's own termination mid chunk.
I believe this is the reference implementation: https://github.com/madler/zlib/blob/master/examples/gzappend.c