buffer: make byteLength work with Buffer correctly · nodejs/node@8d0ca10 · GitHub
Skip to content

Commit 8d0ca10

Browse files
JacksonTianjasnell
authored andcommitted
buffer: make byteLength work with Buffer correctly
Make the byteLength work correctly when input is Buffer. e.g: ```js // The incomplete unicode string Buffer.byteLength(new Buffer([0xe4, 0xb8, 0xad, 0xe6, 0x96])) ``` The old output: 9 The new output: 5 PR-URL: #4738 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent 5f57005 commit 8d0ca10

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

lib/buffer.js

Lines changed: 3 additions & 0 deletions

test/parallel/test-buffer-bytelength.js

Lines changed: 6 additions & 0 deletions

0 commit comments

Comments
 (0)