Skip to content

Commit 4629e8e

Browse files
committed
buffer: optimize for common encodings
1 parent 298ff4f commit 4629e8e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/buffer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1108,7 +1108,7 @@ Buffer.prototype.write = function write(string, offset, length, encoding) {
11081108
}
11091109
}
11101110

1111-
if (!encoding)
1111+
if (!encoding || encoding === 'utf8' || encoding === 'ascii')
11121112
return this.utf8Write(string, offset, length);
11131113

11141114
const ops = getEncodingOps(encoding);

0 commit comments

Comments
 (0)