Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
2c1a3a0
stream: yield bounded batches directly in stream/iter from()
jasnell Oct 4, 2026
d4fcdb2
stream: avoid batch entries for single-chunk pipeTo() writes
jasnell Oct 4, 2026
cae9c28
stream: wait without an async function in stream/iter from()
jasnell Oct 4, 2026
5de8021
stream: normalize async sources without a generator in from()
jasnell Oct 4, 2026
16a470b
stream: normalize sync sources without an async generator in from()
jasnell Oct 4, 2026
f34db9e
stream: run stream/iter transforms without async generators
jasnell Oct 4, 2026
6455135
stream: read stream/iter sources with one abort listener
jasnell Oct 4, 2026
bd0a007
stream: remove async generator layers from stream/iter pull()
jasnell Oct 4, 2026
5dfce47
stream: avoid quadratic batching in zlib/iter transforms
jasnell Oct 4, 2026
b285c8c
stream: use a RingBuffer for stream/iter merge()'s ready queue
jasnell Oct 4, 2026
c95a699
stream: use a RingBuffer for stream/iter broadcast pending reads
jasnell Oct 4, 2026
c947914
stream: use a RingBuffer for the stream/iter operation queue
jasnell Oct 4, 2026
12446b0
stream: append to arrays with indexed stores in stream/iter hot paths
jasnell Oct 4, 2026
81a89c4
stream: read stream/iter push() readables without normalizing
jasnell Oct 4, 2026
0c97416
stream: avoid allocations on every stream/iter push() write
jasnell Oct 4, 2026
fe545a4
stream: snapshot common stream/iter byte views in fewer fields
jasnell Oct 4, 2026
21ae593
stream: resolve stream/iter push() return() with its value
jasnell Oct 4, 2026
b03914a
doc: document stream/iter iterator results and from() identity
jasnell Oct 4, 2026
34d2e53
stream: check stream/iter pipe writes more cheaply
jasnell Oct 4, 2026
a8238df
stream: read sync sources synchronously in stream/iter pipeTo()
jasnell Oct 4, 2026
f0ec6fb
stream: read async sources more cheaply in stream/iter pipeTo()
jasnell Oct 4, 2026
9740e56
stream: do not retain a promise per read in stream/iter share()
jasnell Oct 7, 2026
ee8fc8e
stream: return stream/iter from() results unchanged from from()
jasnell Oct 7, 2026
d34d304
stream: create stream/iter from() values without async generators
jasnell Oct 7, 2026
03fbee1
stream: create stream/iter transform signals and options lazily
jasnell Oct 7, 2026
4c9995b
stream: handle stream/iter pipeline aborts in one place
jasnell Oct 7, 2026
c14822f
stream: keep stream/iter pipeTo() fast paths with a signal
jasnell Oct 7, 2026
c4fd141
stream: read stream/iter consumer sources without a layer per signal
jasnell Oct 7, 2026
67ac69e
stream: read stream/iter from() async sources in one reaction
jasnell Oct 7, 2026
de5426b
stream: check stream/iter byte views by their byteLength alone
jasnell Oct 7, 2026
b8c77da
stream: write to stream/iter writers with only write() inline
jasnell Oct 7, 2026
6056bea
stream: encode small stream/iter strings into a pool
jasnell Oct 7, 2026
d216fa6
stream: read stream/iter share() consumers without a chain per read
jasnell Oct 7, 2026
246c21a
stream: apply stream/iter stateful transforms without async generators
jasnell Oct 7, 2026
575f301
stream: read stream/iter from() sync sources without a generator
jasnell Oct 7, 2026
86be557
stream: read stream/iter share() sync sources at once
jasnell Oct 7, 2026
fc499f8
stream: pump stream/iter Broadcast.from() sources with fewer layers
jasnell Oct 7, 2026
2198474
stream: create stream/iter from() value streams as class instances
jasnell Oct 7, 2026
bb5d3d5
stream: normalize stream/iter fromSync() inputs without generators
jasnell Oct 7, 2026
47eb7f5
stream: read a single stream/iter merge() source without a generator
jasnell Oct 7, 2026
8421511
stream: do not keep stream/iter from() sync sources busy for a tick
jasnell Oct 7, 2026
0dd13da
stream: create stream/iter pending promises without a result object
jasnell Oct 7, 2026
4d6b7c0
stream: keep stream/iter broadcast waiters in reused lists
jasnell Oct 7, 2026
bd3be4d
stream: create the stream/iter share() read reaction once per consumer
jasnell Oct 7, 2026
7768514
stream: read stream/iter from() sources in pipelines without a promis…
jasnell Oct 7, 2026
db58ea2
stream: buffer single-chunk stream/iter push() writes without a batch…
jasnell Oct 7, 2026
74f69b8
stream: buffer single-chunk stream/iter broadcast() and share() batch…
jasnell Oct 7, 2026
bc42576
stream: release only stream/iter reads that can be cancelled while pe…
jasnell Oct 7, 2026
4691367
streams: swap the order of iter result fields
jasnell Nov 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions doc/api/stream_iter.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ are automatically UTF-8 encoded when passed to `from()`, `push()`, or
`pipeTo()`. This removes ambiguity around encodings and enables zero-copy
transfers between streams and native code.

Like [`Buffer.from()`][] for strings, small strings are encoded into a shared
pool: the resulting {Uint8Array} is a view of a larger {ArrayBuffer}, which
cannot be transferred.

### Batching

Each iteration yields a **batch** -- an {Array} of {Uint8Array} chunks
Expand All @@ -119,6 +123,10 @@ async function run() {
}
```

Some iterators of this module return iterator results (`{ done, value }`
objects) that do not inherit from `Object.prototype`. Code should only rely on
their `done` and `value` properties, as `for await...of` does.

### Transforms

Transforms come in two forms:
Expand All @@ -140,10 +148,13 @@ Both forms receive an `options` parameter with the following property:
can check `signal.aborted` or listen for the `'abort'` event to perform
early cleanup.

In `pull()`, stateless transforms receive a new `options` object for every
call, and stateful transforms one for the pipeline, so a transform can modify
its `options` without affecting other transforms. The object does not inherit
from `Object.prototype`. Transforms passed to [`pullSync()`][] receive no
Each transform of a pipeline receives its own `options` object, the same one
for every call of a stateless transform, so a transform can modify its
`options` without affecting other transforms. The object does not inherit
from `Object.prototype`. The signal is created when `options.signal` is
first read, so a pipeline whose transforms never read it does not create one;
until then, `signal` is an accessor property. It is the same signal for every
transform of the pipeline. Transforms passed to [`pullSync()`][] receive no
`options`.

The flush signal (`null`) is sent after the source ends, giving transforms
Expand Down Expand Up @@ -598,6 +609,10 @@ Objects implementing `Symbol.for('Stream.toAsyncStreamable')` or
precedence over the iteration protocols (`Symbol.asyncIterator`,
`Symbol.iterator`).

The readable of a [`push()`][] stream without transforms, the iterables
returned by [`fromReadable()`][], and the results of `from()` itself already
yield normalized batches, so `from()` returns them unchanged.

```mjs
import { Buffer } from 'node:buffer';
import { from, text } from 'node:stream/iter';
Expand Down Expand Up @@ -663,7 +678,9 @@ added:
* `writer` {Object} Destination with `write(chunk)` method.
* `options` {Object}
* `signal` {AbortSignal} Abort the pipeline. Aborting fails the destination
writer unless `preventFail` is `true`.
writer unless `preventFail` is `true`. The signal is passed to the
writer's `write()`, `writev()` and `end()` in an options object, the same
object for every call.
* `preventClose` {boolean} If `true`, do not call `writer.end()` when
the source ends. **Default:** `false`.
* `preventFail` {boolean} If `true`, do not call `writer.fail()` on
Expand Down Expand Up @@ -2400,6 +2417,7 @@ console.log(textSync(stream)); // 'hello world'
[Iterable Streams API]: https://iter-streams.proposal.wintertc.org/
[`--experimental-stream-iter`]: cli.md#--experimental-stream-iter
[`Broadcast.from()`]: #broadcastfrominput-options
[`Buffer.from()`]: buffer.md#static-method-bufferfromstring-encoding
[`Share.from()`]: #static-method-sharefrominput-options
[`SyncShare.fromSync()`]: #static-method-syncsharefromsyncinput-options
[`array()`]: #arraysource-options
Expand All @@ -2415,6 +2433,7 @@ console.log(textSync(stream)); // 'hello world'
[`pipeTo()`]: #pipetosource-transforms-writer-options
[`pull()`]: #pullsource-transforms-options
[`pullSync()`]: #pullsyncsource-transforms
[`push()`]: #pushtransforms-options
[`share()`]: #sharesource-options
[`stream.Readable`]: stream.md#class-streamreadable
[`stream.Writable`]: stream.md#class-streamwritable
Expand Down
Loading
Loading