nearinfinity/node-unzip — pull request #23 by EvanOxfeld (2013-04-04 06:55:01+00:00)
Title: Fix maximum call stack size exceeded

Most of the way fix for #16. Working in node 0.10.3 on jquery-ui-1.10.0.custom.zip but not in node 0.8.x testing against

```javascript
var unzip = require('unzip');
var fs = require('fs');

fs.createReadStream('jquery-ui-1.10.0.custom.zip')
.pipe(unzip.Extract({ path: 'test' }))
.on('error', function (err) { console.log('error', err); })
.on('close', function () { console.log('closed'); });
```

Current hang up is 34f30cc3c47c9792fbce7c8dbb48b59463bd9555 and more specifically the MatchStream starting on parse.js line 158. For archives that contain variable length file data, unzip.Parse needs to stop sending data to the zlib inflater stream when the data descriptor signature is reached. In Node 0.10.x the MatchStream stops the flow of data correctly because the process.nextTick on line 165 happens on the current tick before I/O. Unfortunately, in Node 0.8.x I/O can happen before a process.nextTick, which causes erroneous writes to the MatchStream (and later the zlib inflater stream and the entry).

Feedback is much appreciated.

/cc @satazor