diff --git a/lib/_stream_writable.js b/lib/_stream_writable.js index 78ab13d9063c67..334f492ba68eef 100644 --- a/lib/_stream_writable.js +++ b/lib/_stream_writable.js @@ -248,7 +248,7 @@ function validChunk(stream, state, chunk, cb) { Writable.prototype.write = function(chunk, encoding, cb) { var state = this._writableState; var ret = false; - var isBuf = Stream._isUint8Array(chunk) && !state.objectMode; + var isBuf = !state.objectMode && Stream._isUint8Array(chunk); if (isBuf && Object.getPrototypeOf(chunk) !== Buffer.prototype) { chunk = Stream._uint8ArrayToBuffer(chunk);