stream: add bytes() method to stream/consumers#60426
Conversation
|
Review requested:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #60426 +/- ##
==========================================
+ Coverage 88.58% 89.79% +1.21%
==========================================
Files 704 673 -31
Lines 207823 203830 -3993
Branches 40049 39174 -875
==========================================
- Hits 184101 183037 -1064
+ Misses 15772 13140 -2632
+ Partials 7950 7653 -297
🚀 New features to boost your workflow:
|
3887f53 to
4117fc0
Compare
- Add bytes() method to get Uint8Array from streams - Add tests for bytes() method in PassThrough and ObjectMode scenarios - Update documentation Fixes: #59542
4117fc0 to
b6a5a18
Compare
Co-authored-by: René <contact.9a5d6388@renegade334.me.uk>
Ethan-Arrowood
left a comment
There was a problem hiding this comment.
This LGTM but I'm not explicitly approving it. I don't know why we really need this when user's could do new Uint8Array(await arrayBuffer(stream)); themselves (or rather any conversion from the raw ArrayBuffer).
|
Looking at the issue, I see this is meant to align us with the new I'm okay with that then :) nice work! |
Co-authored-by: jakecastelli <38635403+jakecastelli@users.noreply.github.com>
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment has been minimized.
This comment has been minimized.
|
Landed in 938f175 |
- Add bytes() method to get Uint8Array from streams - Add tests for bytes() method in PassThrough and ObjectMode scenarios - Update documentation Fixes: #59542 PR-URL: #60426 Reviewed-By: Ethan Arrowood <ethan@arrowood.dev> Reviewed-By: René <contact.9a5d6388@renegade334.me.uk> Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com> Reviewed-By: Mattias Buelens <mattias@buelens.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Notable changes: async_hooks: * (SEMVER-MINOR) add trackPromises option to createHook() (Joyee Cheung) #61415 src: * improve textEncoder encode performance with simdutf (Mert Can Altin) #61496 stream: * (SEMVER-MINOR) add bytes() method to stream/consumers (wantaek) #60426 test_runner: * (SEMVER-MINOR) add env option to run function (Ethan Arrowood) #61367 url: * update ada to v3.4.2 and support unicode 17 (Yagiz Nizipli) #61593 PR-URL: #61635
- Add bytes() method to get Uint8Array from streams - Add tests for bytes() method in PassThrough and ObjectMode scenarios - Update documentation Fixes: #59542 PR-URL: #60426 Reviewed-By: Ethan Arrowood <ethan@arrowood.dev> Reviewed-By: René <contact.9a5d6388@renegade334.me.uk> Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com> Reviewed-By: Mattias Buelens <mattias@buelens.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Notable changes: async_hooks: * (SEMVER-MINOR) add `trackPromises` option to `createHook()` (Joyee Cheung) #61415 net: * (SEMVER-MINOR) add `setTOS` and `getTOS` to `Socket` (Amol Yadav) #61503 src: * (SEMVER-MINOR) add initial support for ESM in embedder API (Joyee Cheung) #61548 * improve `TextEncoder` encode performance with `simdutf` (Mert Can Altin) #61496 stream: * (SEMVER-MINOR) add `bytes()` method to `node:stream/consumers` (wantaek) #60426 test_runner: * (SEMVER-MINOR) add `env` option to `run` function (Ethan Arrowood) #61367 url: * update Ada to v3.4.2 and support Unicode 17 (Yagiz Nizipli) #61593 PR-URL: #61635
Notable changes: async_hooks: * (SEMVER-MINOR) add `trackPromises` option to `createHook()` (Joyee Cheung) #61415 net: * (SEMVER-MINOR) add `setTOS` and `getTOS` to `Socket` (Amol Yadav) #61503 src: * (SEMVER-MINOR) add initial support for ESM in embedder API (Joyee Cheung) #61548 * improve `TextEncoder` encode performance with `simdutf` (Mert Can Altin) #61496 stream: * (SEMVER-MINOR) add `bytes()` method to `node:stream/consumers` (wantaek) #60426 test_runner: * (SEMVER-MINOR) add `env` option to `run` function (Ethan Arrowood) #61367 url: * update Ada to v3.4.2 and support Unicode 17 (Yagiz Nizipli) #61593 PR-URL: #61635
Notable changes: async_hooks: * (SEMVER-MINOR) add `trackPromises` option to `createHook()` (Joyee Cheung) #61415 net: * (SEMVER-MINOR) add `setTOS` and `getTOS` to `Socket` (Amol Yadav) #61503 src: * (SEMVER-MINOR) add initial support for ESM in embedder API (Joyee Cheung) #61548 * improve `TextEncoder` encode performance with `simdutf` (Mert Can Altin) #61496 stream: * (SEMVER-MINOR) add `bytes()` method to `node:stream/consumers` (wantaek) #60426 test_runner: * (SEMVER-MINOR) add `env` option to `run` function (Ethan Arrowood) #61367 url: * update Ada to v3.4.2 and support Unicode 17 (Yagiz Nizipli) #61593 PR-URL: #61635
- Add bytes() method to get Uint8Array from streams - Add tests for bytes() method in PassThrough and ObjectMode scenarios - Update documentation Fixes: #59542 PR-URL: #60426 Reviewed-By: Ethan Arrowood <ethan@arrowood.dev> Reviewed-By: René <contact.9a5d6388@renegade334.me.uk> Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com> Reviewed-By: Mattias Buelens <mattias@buelens.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
- Add bytes() method to get Uint8Array from streams - Add tests for bytes() method in PassThrough and ObjectMode scenarios - Update documentation Fixes: #59542 PR-URL: #60426 Reviewed-By: Ethan Arrowood <ethan@arrowood.dev> Reviewed-By: René <contact.9a5d6388@renegade334.me.uk> Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com> Reviewed-By: Mattias Buelens <mattias@buelens.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Notable changes: async_hooks: * (SEMVER-MINOR) add trackPromises option to createHook() (Joyee Cheung) #61415 build,deps: * replace cjs-module-lexer with merve (Yagiz Nizipli) #61456 deps: * (SEMVER-MINOR) add LIEF as a dependency (Joyee Cheung) #61167 * (SEMVER-MINOR) add tools and scripts to pull LIEF as a dependency (Joyee Cheung) #61167 events: * (SEMVER-MINOR) repurpose `events.listenerCount()` to accept EventTargets (René) #60214 fs: * (SEMVER-MINOR) add ignore option to fs.watch (Matteo Collina) #61433 http: * (SEMVER-MINOR) add http.setGlobalProxyFromEnv() (Joyee Cheung) #60953 module: * (SEMVER-MINOR) allow subpath imports that start with `#/` (Jan Martin) #60864 process: * (SEMVER-MINOR) preserve AsyncLocalStorage in queueMicrotask only when needed (Gürgün Dayıoğlu) #60913 sea: * (SEMVER-MINOR) split sea binary manipulation code (Joyee Cheung) #61167 sqlite: * (SEMVER-MINOR) enable defensive mode by default (Bart Louwers) #61266 * (SEMVER-MINOR) add sqlite prepare options args (Guilherme Araújo) #61311 src: * (SEMVER-MINOR) add initial support for ESM in embedder API (Joyee Cheung) #61548 stream: * (SEMVER-MINOR) add bytes() method to stream/consumers (wantaek) #60426 * (SEMVER-MINOR) do not pass `readable.compose()` output via `Readable.from()` (René) #60907 test: * (SEMVER-MINOR) use fixture directories for sea tests (Joyee Cheung) #61167 test_runner: * (SEMVER-MINOR) add env option to run function (Ethan Arrowood) #61367 * (SEMVER-MINOR) support expecting a test-case to fail (Jacob Smith) #60669 util: * (SEMVER-MINOR) add convertProcessSignalToExitCode utility (Erick Wendel) #60963 PR-URL: #61924
- Add bytes() method to get Uint8Array from streams - Add tests for bytes() method in PassThrough and ObjectMode scenarios - Update documentation Fixes: #59542 PR-URL: #60426 Reviewed-By: Ethan Arrowood <ethan@arrowood.dev> Reviewed-By: René <contact.9a5d6388@renegade334.me.uk> Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com> Reviewed-By: Mattias Buelens <mattias@buelens.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Notable changes: async_hooks: * (SEMVER-MINOR) add `trackPromises` option to `createHook()` (Joyee Cheung) #61415 build,deps: * replace cjs-module-lexer with merve (Yagiz Nizipli) #61456 deps: * (SEMVER-MINOR) add LIEF as a dependency (Joyee Cheung) #61167 events: * (SEMVER-MINOR) repurpose `events.listenerCount()` to accept `EventTarget`s (René) #60214 fs: * (SEMVER-MINOR) add `ignore` option to `fs.watch` (Matteo Collina) #61433 http: * (SEMVER-MINOR) add `http.setGlobalProxyFromEnv()` (Joyee Cheung) #60953 module: * (SEMVER-MINOR) allow subpath imports that start with `#/` (Jan Martin) #60864 process: * (SEMVER-MINOR) preserve `AsyncLocalStorage` in `queueMicrotask` only when needed (Gürgün Dayıoğlu) #60913 sea: * (SEMVER-MINOR) split sea binary manipulation code (Joyee Cheung) #61167 sqlite: * (SEMVER-MINOR) enable defensive mode by default (Bart Louwers) #61266 * (SEMVER-MINOR) add sqlite prepare options args (Guilherme Araújo) #61311 src: * (SEMVER-MINOR) add initial support for ESM in embedder API (Joyee Cheung) #61548 stream: * (SEMVER-MINOR) add `bytes()` method to `node:stream/consumers` (wantaek) #60426 * (SEMVER-MINOR) do not pass `readable.compose()` output via `Readable.from()` (René) #60907 test: * (SEMVER-MINOR) use fixture directories for sea tests (Joyee Cheung) #61167 test_runner: * (SEMVER-MINOR) add `env` option to `run` function (Ethan Arrowood) #61367 * (SEMVER-MINOR) support expecting a test-case to fail (Jacob Smith) #60669 util: * (SEMVER-MINOR) add `convertProcessSignalToExitCode` utility (Erick Wendel) #60963 PR-URL: #61924
Notable changes: async_hooks: * (SEMVER-MINOR) add `trackPromises` option to `createHook()` (Joyee Cheung) #61415 build,deps: * replace cjs-module-lexer with merve (Yagiz Nizipli) #61456 deps: * (SEMVER-MINOR) add LIEF as a dependency (Joyee Cheung) #61167 events: * (SEMVER-MINOR) repurpose `events.listenerCount()` to accept `EventTarget`s (René) #60214 fs: * (SEMVER-MINOR) add `ignore` option to `fs.watch` (Matteo Collina) #61433 http: * (SEMVER-MINOR) add `http.setGlobalProxyFromEnv()` (Joyee Cheung) #60953 module: * (SEMVER-MINOR) allow subpath imports that start with `#/` (Jan Martin) #60864 process: * (SEMVER-MINOR) preserve `AsyncLocalStorage` in `queueMicrotask` only when needed (Gürgün Dayıoğlu) #60913 sea: * (SEMVER-MINOR) split sea binary manipulation code (Joyee Cheung) #61167 sqlite: * (SEMVER-MINOR) enable defensive mode by default (Bart Louwers) #61266 * (SEMVER-MINOR) add sqlite prepare options args (Guilherme Araújo) #61311 src: * (SEMVER-MINOR) add initial support for ESM in embedder API (Joyee Cheung) #61548 stream: * (SEMVER-MINOR) add `bytes()` method to `node:stream/consumers` (wantaek) #60426 * (SEMVER-MINOR) do not pass `readable.compose()` output via `Readable.from()` (René) #60907 test: * (SEMVER-MINOR) use fixture directories for sea tests (Joyee Cheung) #61167 test_runner: * (SEMVER-MINOR) add `env` option to `run` function (Ethan Arrowood) #61367 * (SEMVER-MINOR) support expecting a test-case to fail (Jacob Smith) #60669 util: * (SEMVER-MINOR) add `convertProcessSignalToExitCode` utility (Erick Wendel) #60963 PR-URL: #61924
Notable changes: async_hooks: * (SEMVER-MINOR) add `trackPromises` option to `createHook()` (Joyee Cheung) nodejs#61415 build,deps: * replace cjs-module-lexer with merve (Yagiz Nizipli) nodejs#61456 deps: * (SEMVER-MINOR) add LIEF as a dependency (Joyee Cheung) nodejs#61167 events: * (SEMVER-MINOR) repurpose `events.listenerCount()` to accept `EventTarget`s (René) nodejs#60214 fs: * (SEMVER-MINOR) add `ignore` option to `fs.watch` (Matteo Collina) nodejs#61433 http: * (SEMVER-MINOR) add `http.setGlobalProxyFromEnv()` (Joyee Cheung) nodejs#60953 module: * (SEMVER-MINOR) allow subpath imports that start with `#/` (Jan Martin) nodejs#60864 process: * (SEMVER-MINOR) preserve `AsyncLocalStorage` in `queueMicrotask` only when needed (Gürgün Dayıoğlu) nodejs#60913 sea: * (SEMVER-MINOR) split sea binary manipulation code (Joyee Cheung) nodejs#61167 sqlite: * (SEMVER-MINOR) enable defensive mode by default (Bart Louwers) nodejs#61266 * (SEMVER-MINOR) add sqlite prepare options args (Guilherme Araújo) nodejs#61311 src: * (SEMVER-MINOR) add initial support for ESM in embedder API (Joyee Cheung) nodejs#61548 stream: * (SEMVER-MINOR) add `bytes()` method to `node:stream/consumers` (wantaek) nodejs#60426 * (SEMVER-MINOR) do not pass `readable.compose()` output via `Readable.from()` (René) nodejs#60907 test: * (SEMVER-MINOR) use fixture directories for sea tests (Joyee Cheung) nodejs#61167 test_runner: * (SEMVER-MINOR) add `env` option to `run` function (Ethan Arrowood) nodejs#61367 * (SEMVER-MINOR) support expecting a test-case to fail (Jacob Smith) nodejs#60669 util: * (SEMVER-MINOR) add `convertProcessSignalToExitCode` utility (Erick Wendel) nodejs#60963 PR-URL: nodejs#61924
Notable changes: async_hooks: * (SEMVER-MINOR) add `trackPromises` option to `createHook()` (Joyee Cheung) #61415 build,deps: * replace cjs-module-lexer with merve (Yagiz Nizipli) #61456 deps: * (SEMVER-MINOR) add LIEF as a dependency (Joyee Cheung) #61167 events: * (SEMVER-MINOR) repurpose `events.listenerCount()` to accept `EventTarget`s (René) #60214 fs: * (SEMVER-MINOR) add `ignore` option to `fs.watch` (Matteo Collina) #61433 http: * (SEMVER-MINOR) add `http.setGlobalProxyFromEnv()` (Joyee Cheung) #60953 module: * (SEMVER-MINOR) allow subpath imports that start with `#/` (Jan Martin) #60864 process: * (SEMVER-MINOR) preserve `AsyncLocalStorage` in `queueMicrotask` only when needed (Gürgün Dayıoğlu) #60913 sea: * (SEMVER-MINOR) split sea binary manipulation code (Joyee Cheung) #61167 sqlite: * (SEMVER-MINOR) enable defensive mode by default (Bart Louwers) #61266 * (SEMVER-MINOR) add sqlite prepare options args (Guilherme Araújo) #61311 src: * (SEMVER-MINOR) add initial support for ESM in embedder API (Joyee Cheung) #61548 stream: * (SEMVER-MINOR) add `bytes()` method to `node:stream/consumers` (wantaek) #60426 * (SEMVER-MINOR) do not pass `readable.compose()` output via `Readable.from()` (René) #60907 test: * (SEMVER-MINOR) use fixture directories for sea tests (Joyee Cheung) #61167 test_runner: * (SEMVER-MINOR) add `env` option to `run` function (Ethan Arrowood) #61367 * (SEMVER-MINOR) support expecting a test-case to fail (Jacob Smith) #60669 util: * (SEMVER-MINOR) add `convertProcessSignalToExitCode` utility (Erick Wendel) #60963 PR-URL: #61924
stream: add bytes() method to stream/consumers
Add a
bytes()method to thestream/consumersmodule that returns a Uint8Array, providing a convenient way to consume streams as typed arrays.Fixes: #59542