Permalink
1 comment
on commit
sign in to comment.
Browse files
buffer: allow Uint8Array input to methods
Allow all methods on `buffer` and `Buffer` to take `Uint8Array` arguments where it makes sense. On the native side, there is effectively no difference, and as a bonus the `isUint8Array` check is faster than `instanceof Buffer`. PR-URL: #10236 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Trevor Norris <trev.norris@gmail.com> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
- Loading branch information
Showing
with
81 additions
and 45 deletions.
- +12 −12 doc/api/buffer.md
- +25 −18 lib/buffer.js
- +4 −3 lib/internal/buffer.js
- +9 −9 src/node_buffer.cc
- +2 −1 src/node_util.cc
- +5 −0 test/parallel/test-buffer-compare.js
- +6 −1 test/parallel/test-buffer-concat.js
- +1 −0 test/parallel/test-buffer-equals.js
- +8 −0 test/parallel/test-buffer-indexof.js
- +9 −1 test/parallel/test-icu-transcode.js
This comment has been minimized.
beca324when using socket.io , sometimes raise error about Uint8Array
RangeError: Maximum call stack size exceeded
at Buffer.Uint8Array (native)
at FastBuffer (buffer.js:11:5)
at fromString (buffer.js:221:11)
at Function.Buffer.from (buffer.js:114:12)
at new Buffer (buffer.js:95:17)
at Sender.frameAndSend (/root/dataset-cooker/node_modules/ws/lib/Sender.js:166:14)
at /root/dataset-cooker/node_modules/ws/lib/Sender.js:126:12
at Sender.applyExtensions (/root/dataset-cooker/node_modules/ws/lib/Sender.js:287:5)
at /root/dataset-cooker/node_modules/ws/lib/Sender.js:120:10
at Sender.flush (/root/dataset-cooker/node_modules/ws/lib/Sender.js:268:3)