stream: make setEncoding chainable
This commit is contained in:
parent
9ef9a9dee5
commit
f91b047891
@ -198,6 +198,7 @@ Readable.prototype.setEncoding = function(enc) {
|
|||||||
StringDecoder = require('string_decoder').StringDecoder;
|
StringDecoder = require('string_decoder').StringDecoder;
|
||||||
this._readableState.decoder = new StringDecoder(enc);
|
this._readableState.decoder = new StringDecoder(enc);
|
||||||
this._readableState.encoding = enc;
|
this._readableState.encoding = enc;
|
||||||
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Don't raise the hwm > 128MB
|
// Don't raise the hwm > 128MB
|
||||||
|
@ -359,3 +359,9 @@ test('encoding: base64', function(t) {
|
|||||||
t.end();
|
t.end();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('chainable', function(t) {
|
||||||
|
var tr = new TestReader(100);
|
||||||
|
t.equal(tr.setEncoding('utf8'), tr);
|
||||||
|
t.end();
|
||||||
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user