Parser: remove Readable proxied event for node 0.8

readable-stream proxies some events in wrap(). Since the Parser doesn't care about any events other than 'readable', we remove the troublesome proxied 'error' event.

Fixes #285
fork
Brian White 11 years ago
parent f139ce9842
commit 510aa0b7b9

@ -55,17 +55,14 @@ inherits(Parser, EventEmitter);
Parser.prototype.setStream = function(stream) {
if (/^v0\.8\./.test(process.version)) {
var newStream = new ReadableStream(),
wrapped = newStream.wrap(stream);
// as of now, 07/02/2013, the readable-stream module is behind in updates
// and has different behavior for the return value of wrap() compared to
// node v0.10+, so we check for that here ...
if (wrapped)
stream = wrapped;
else
stream = newStream;
}
this._stream = stream;
this._stream = (new ReadableStream()).wrap(stream);
// since Readable.wrap() proxies events, we need to remove at least the
// proxied 'error' event since this can cause problems and Parser doesn't
// care about such events
stream._events.error.pop();
} else
this._stream = stream;
};
Parser.prototype._tryread = function(n) {

@ -6,7 +6,7 @@
"dependencies": {
"utf7": "1.0.0",
"iconv-lite": "0.2.11",
"readable-stream": "1.0.2"
"readable-stream": "1.0.15"
},
"scripts": {
"test": "node test/test.js"

Loading…
Cancel
Save