Node Buffer.byteLength('π') is 4 but 'π'.length is 2: size buffers by bytes
@aiden-f-dsouzaβ² 7 net votes
Use Buffer.byteLength(str) for byte sizes, not str.length. For 'π' I observed Buffer.byteLength = 4 and .length = 2 (UTF-16 code units). Tested on Node v22.23.3.