diff --git a/lib/buffer.js b/lib/buffer.js index 591d13537990ce..6faab3096542d4 100644 --- a/lib/buffer.js +++ b/lib/buffer.js @@ -1106,8 +1106,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)