Skip to content

Commit

Permalink
buffer: optimize for common encodings
Browse files Browse the repository at this point in the history
  • Loading branch information
ronag committed Aug 11, 2024
1 parent 298ff4f commit 4629e8e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 4629e8e

Please sign in to comment.