Trivikram Kamat
68dc116f34
stream: skip null output from stateful transforms
...
Treat null yielded by sync and async stateful transforms as no output,
consistent with transform normalization semantics.
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
PR-URL: https://github.com/nodejs/node/pull/64462
Fixes: https://github.com/nodejs/node/issues/64461
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
2026-07-23 23:32:17 +00:00
James M Snell
b9ed467618
stream: update iterable streams to use budget backpressure
...
Updates the implementation to use the updated backpressure
model that landed here: https://github.com/WinterTC55/iter-streams/pull/23
Signed-off-by: James M Snell <jasnell@gmail.com >
Assisted-by: Opencode/Opus
PR-URL: https://github.com/nodejs/node/pull/64464
Reviewed-By: Tim Perry <pimterry@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
2026-07-23 05:19:44 -07:00
Trivikram Kamat
b59def5e81
stream: reject iter consumers on abort
...
Make stream/iter async consumers observe abort signals while waiting
for a pending async iterator read. This lets bytes(), text(),
arrayBuffer(), and array() reject promptly with the abort reason
instead of waiting for another batch.
Move the shared abort-aware iterator wrapper to stream/iter utils so
pull and consumers use the same helper.
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/64066
Fixes: https://github.com/nodejs/node/issues/64065
Reviewed-By: James M Snell <jasnell@gmail.com >
2026-07-04 22:12:51 +00:00
Trivikram Kamat
a0263feb16
stream: observe abort while awaiting pipeTo source
...
Use the abort-aware iterator wrapper in the no-transform pipeTo()
path so a pending source read does not block AbortSignal handling.
Fixes: https://github.com/nodejs/node/issues/64014
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/64015
Fixes: https://github.com/nodejs/node/issues/64014
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Filip Skokan <panva.ip@gmail.com >
2026-06-22 07:47:40 +00:00
James M Snell
b03e6e0997
stream: refine the stream/iter backpressure
...
In `Writer`, there are two queues that matter: the slot queue
and the pending queue. The sync `writeSync`/`writevSync` only
use the slot queue. If writes cannot be accepted directly into
slots, they return `false`. The sync methods *never* enqueue
into the pending queue. The async `write`/`writev` will first
attempt to add to the slot queue; if it is full, then it will
attempt to add to the pending queue; if that is also full, the
backpressure policy kicks in.
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/63697
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day >
2026-06-17 16:08:46 +00:00
Trivikram Kamat
9d2db708ca
stream: remove transform-writer handling in pipeTo
...
The pipeTo() and pipeToSync() argument parser already requires the
destination argument to be a writer. Remove the later transform-writer
handling so writer objects with a transform() method are treated only
as destinations.
Fixes: https://github.com/nodejs/node/issues/63683
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/63684
Fixes: https://github.com/nodejs/node/issues/63683
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2026-06-15 03:49:40 +00:00
Trivikram Kamat
696030d7a1
stream: fix pipeToSync byte accounting
...
Stop pipeToSync() from counting chunks when writeSync() or writevSync()
returns false without accepting the data. Preserve writers that use
false as an accepted backpressure signal.
Fixes: https://github.com/nodejs/node/issues/63562
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/63564
Fixes: https://github.com/nodejs/node/issues/63562
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2026-06-08 22:45:07 +00:00
Trivikram Kamat
822ef3afb6
stream: reject pull() reads on abort
...
Make pull() race pending source reads against the provided AbortSignal
so aborting can reject a pending next() even when the source is waiting
before yielding data.
Fixes: https://github.com/nodejs/node/issues/63497
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/63498
Fixes: https://github.com/nodejs/node/issues/63497
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2026-06-07 19:16:05 +00:00
Trivikram Kamat
5f727fdc89
stream: fast-path stateless transform flush results
...
Avoid generator-based normalization for common flush result types in
fused stateless stream/iter transforms. This keeps the corrected flush
ordering while reducing overhead for already-normalized batches and
primitive byte outputs.
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/63605
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2026-06-04 05:38:18 +00:00
Trivikram Kamat
c126cbfd9b
stream: handle sync writev completion in pipeTo
...
Treat writer.writev() returning undefined as synchronous success to
match the existing write() fallback behavior for duck-typed writers.
This avoids calling Promise.prototype.then on undefined after a batch
write has already been accepted.
Fixes: https://github.com/nodejs/node/issues/63560
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/63561
Fixes: https://github.com/nodejs/node/issues/63560
Reviewed-By: James M Snell <jasnell@gmail.com >
2026-06-01 17:03:09 +00:00
Trivikram Kamat
837910d298
stream: flush each fused stateless transform
...
Ensure consecutive stateless stream/iter transforms each receive a
final null flush after upstream flush output has been processed.
Fixes: https://github.com/nodejs/node/issues/63467
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/63468
Fixes: https://github.com/nodejs/node/issues/63467
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2026-05-23 21:43:57 +00:00
Trivikram Kamat
1f371fcffb
stream: add sync iterable fast path to pipeTo
...
Avoid normalizing sync iterable sources through from() when pipeTo()
has no transforms or signal and the writer can accept sync writes.
This keeps writes incremental while preserving async fallback for
values that still need it.
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/63318
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
2026-05-17 23:06:55 +00:00
Trivikram Kamat
8c6e39e459
stream: avoid retrying accepted pipeTo writes
...
PushWriter in block backpressure mode can return false from writeSync()
and writevSync() after accepting data. Treat that false return as
backpressure and wait for drain instead of retrying the same chunks
asynchronously.
Fixes: https://github.com/nodejs/node/issues/63296
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/63297
Fixes: https://github.com/nodejs/node/issues/63296
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
2026-05-16 14:44:46 +00:00
René
2b6ce135e3
stream: minor stream/iter implementation edits
...
Signed-off-by: Renegade334 <contact.9a5d6388@renegade334.me.uk >
PR-URL: https://github.com/nodejs/node/pull/63132
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2026-05-08 14:59:31 +00:00
René
6df4f7bf27
stream: remove redundant method check from iter.pipeToSync
...
Signed-off-by: Renegade334 <contact.9a5d6388@renegade334.me.uk >
PR-URL: https://github.com/nodejs/node/pull/63099
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2026-05-05 12:46:54 +00:00
James M Snell
500c3a53e3
stream: add stream/iter to classic stream adapters
...
Signed-off-by: James M Snell <jasnell@gmail.com >
Assisted-by: Opencode/Opus 4.6
PR-URL: https://github.com/nodejs/node/pull/62469
Reviewed-By: Robert Nagy <ronagy@icloud.com >
2026-04-06 09:59:56 -07:00
James M Snell
ae7c6a7767
stream: add stream/iter Implementation
...
Experimental implementation of https://stream-iter.jasnell.me/
Signed-off-by: James M Snell <jasnell@gmail.com >
Assisted-By: Claude/Opus 4.6
PR-URL: https://github.com/nodejs/node/pull/62066
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2026-03-27 19:55:08 -07:00