diff options
author | isaacs <i@izs.me> | 2013-03-05 23:37:37 -0800 |
---|---|---|
committer | isaacs <i@izs.me> | 2013-03-06 11:44:30 -0800 |
commit | a978bedee79eee31b583a2bc9bdab27fa6cd95f3 (patch) | |
tree | 32b8ac15316644a2249546dcfdc382ea73722743 /lib | |
parent | b0f6789a78dbb14778769d1d76b195c2fcd8a340 (diff) | |
download | android-node-v8-a978bedee79eee31b583a2bc9bdab27fa6cd95f3.tar.gz android-node-v8-a978bedee79eee31b583a2bc9bdab27fa6cd95f3.tar.bz2 android-node-v8-a978bedee79eee31b583a2bc9bdab27fa6cd95f3.zip |
stream: Allow strings in Readable.push/unshift
Fix #4909
Diffstat (limited to 'lib')
-rw-r--r-- | lib/_stream_readable.js | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js index 627b850940..bf646f99ac 100644 --- a/lib/_stream_readable.js +++ b/lib/_stream_readable.js @@ -98,11 +98,15 @@ function Readable(options) { // write() some more. Readable.prototype.push = function(chunk) { var state = this._readableState; + if (typeof chunk === 'string' && !state.objectMode) + chunk = new Buffer(chunk, arguments[1]); return readableAddChunk(this, state, chunk, false); }; Readable.prototype.unshift = function(chunk) { var state = this._readableState; + if (typeof chunk === 'string' && !state.objectMode) + chunk = new Buffer(chunk, arguments[1]); return readableAddChunk(this, state, chunk, true); }; |