Commit Graph

15 Commits

Author SHA1 Message Date
Debadree Chatterjee
23effb255e
stream: add pipeline() for webstreams
Refs: https://github.com/nodejs/node/issues/39316
PR-URL: https://github.com/nodejs/node/pull/46307
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2023-02-02 19:45:42 +00:00
Debadree Chatterjee
32254988ba
stream: implement finished() for ReadableStream and WritableStream
Refs: https://github.com/nodejs/node/issues/39316
PR-URL: https://github.com/nodejs/node/pull/46205
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2023-01-18 07:56:49 +00:00
Rich Trott
20347d5154
stream: avoid function call where possible
Instead of assigning a boolean, move the function call that assigns a
value to the boolean to the only place that boolean is checked. This
avoids the function call in cases where it is not needed.

Refs: https://github.com/nodejs/node/pull/41488#pullrequestreview-850626528

PR-URL: https://github.com/nodejs/node/pull/41534
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2022-01-17 05:31:30 +00:00
Rich Trott
f7be6ab042
stream: remove always-false condition check
Remove comparison to null of variable guaranteed to be a boolean.

PR-URL: https://github.com/nodejs/node/pull/41488
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
2022-01-15 00:07:46 +00:00
Robert Nagy
a698c49993 stream: add isReadable helper
PR-URL: https://github.com/nodejs/node/pull/41199
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-12-29 20:42:10 +01:00
Robert Nagy
752d75d8bc stream: add isErrored helper
Refs: https://github.com/nodejs/undici/pull/1134

PR-URL: https://github.com/nodejs/node/pull/41121
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
2021-12-16 14:28:31 +01:00
Robert Nagy
49b8c4f08b
stream: stricter isReadableNodeStream
Fixes: https://github.com/nodejs/node/issues/40938

PR-URL: https://github.com/nodejs/node/pull/40941
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-11-26 17:33:05 +00:00
Robert Nagy
f2170253b6 stream: add errored and closed props
PR-URL: https://github.com/nodejs/node/pull/40696
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-11-13 11:19:32 +02:00
Robert Nagy
4832d1c02c stream: add isDisturbed helper
Adds a helper util used to determine whether a stream has been
disturbed (read or cancelled).

Refs: https://github.com/nodejs/node/issues/39627

PR-URL: https://github.com/nodejs/node/pull/39628
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2021-08-06 07:45:38 +02:00
Robert Nagy
533cafcf7e stream: duplexify
PR-URL: https://github.com/nodejs/node/pull/39519
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2021-08-03 10:47:10 +02:00
Robert Nagy
e579acb8dc stream: add stream.compose
Refs: #32020

PR-URL: https://github.com/nodejs/node/pull/39029
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2021-07-19 08:14:32 +02:00
Robert Nagy
bb275ef2a4 stream: unify stream utils
Unify stream helps into utils.

PR-URL: https://github.com/nodejs/node/pull/39294
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-07-11 10:40:30 +02:00
Qingyu Deng
b9ef539eae
stream: allow empty string as source of pipeline
Fixes: https://github.com/nodejs/node/issues/38721

PR-URL: https://github.com/nodejs/node/pull/38723
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
2021-05-20 09:46:47 -07:00
Nitzan Uziely
9b87ab4071
stream: pipeline accept Buffer as a valid first argument
change isStream to also check existence of on, so it
wont mistake buffers as Streams.

fixes: https://github.com/nodejs/node/issues/37731

PR-URL: https://github.com/nodejs/node/pull/37739
Fixes: https://github.com/nodejs/node/issues/37731
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-03-22 08:22:56 -07:00
Rich Trott
1e34df139c stream: move duplicated code to an internal module
Create a utils module for isIterable(), isReadable(), and isStream().

PR-URL: https://github.com/nodejs/node/pull/37508
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2021-02-28 05:07:26 -08:00