From 4629e8ef0b86c79843b602f9f92f210651ac125d Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Sun, 11 Aug 2024 18:14:26 +0200 Subject: [PATCH] buffer: optimize for common encodings --- lib/buffer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/buffer.js b/lib/buffer.js index 4e6031afdb3919..407d5de142eef9 100644 --- a/lib/buffer.js +++ b/lib/buffer.js @@ -1108,7 +1108,7 @@ Buffer.prototype.write = function write(string, offset, length, encoding) { } } - if (!encoding) + if (!encoding || encoding === 'utf8' || encoding === 'ascii') return this.utf8Write(string, offset, length); const ops = getEncodingOps(encoding);