diff --git a/lib/buffer.js b/lib/buffer.js index 4e6031afdb3919..ac562b6865dea9 100644 --- a/lib/buffer.js +++ b/lib/buffer.js @@ -1108,8 +1108,10 @@ Buffer.prototype.write = function write(string, offset, length, encoding) { } } - if (!encoding) + if (!encoding || encoding === 'utf8') return this.utf8Write(string, offset, length); + if (encoding === 'ascii') + return this.asciiWrite(string, offset, length); const ops = getEncodingOps(encoding); if (ops === undefined)