Index of every page on this site: llms.txt
All skills
jasnell avatar

/node-stream-iter

@5f83e6c
Run it yourself

Experimental iterable-first streams API, node:stream/iter (behind --experimental-stream-iter). Use only when the user asks for stream/iter or that flag, or explicitly accepts an experimental API for async-iterable stream pipelines with backpressure. Without that opt-in, prefer classic node:stream for production code. Covers from/pull/pipeTo/push/duplex/broadcast/share, text/bytes/array consumers, transforms, filehandle.pull/writer, fromReadable/toReadable interop and node:zlib/iter compressGzip/decompressZstd. Node.js 24.20+ or 25.9+; behavior differs before 26.12.

Use this Skill: https://skilld.dev/gh/jasnell/node-skills/node-stream-iter

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

rulesversions.md

≈582 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Version differences: v24.x versus v26.12+

stream/iter landed on main as v25.9.0 and was backported to v24.20.0. A large follow-up (#66483) shipped in v26.12.0 and has not been backported to v24.x. Checked on v24.22.3, v26.13.0 and main. The v26.1 to v26.11 rows come from CHANGELOG_V26, because no binary for those versions was run. The docs (pinned at ab476eccd03) describe only the v26.12+ behavior and have no changes: entries for these differences.

Behavior v24.x (v24.22.3), v26 before 26.12 v26.12+ and main
budget for push, duplex, broadcast, share, shareSync must be >= 16384; smaller values throw ERR_OUT_OF_RANGE any positive integer
pull(src, { signal }) with an already-aborted signal throws signal.reason synchronously from pull() returns an iterable, and reading it rejects
pipeToSync() when writer.endSync() returns -1 returns the byte count; the close finishes once the data is read throws ERR_INVALID_STATE
pipeToSync({ failOnIncompleteClose }) not recognized (ignored) supported
shareSync({ backpressure: 'unbounded' | 'drop-newest' }) accepted throws ERR_INVALID_ARG_VALUE
dump(), dumpSync() absent (dump is not exported) v26.12.0+

These are the same on both lines: node:zlib/iter (present on v24.22.3), the classic stream adapters, Readable[Symbol.for('Stream.toAsyncStreamable')] (present even without the flag), filehandle.pull/writer, the strict-mode rejection of unawaited writes, 'drop-oldest' eviction, and consumer signal/limit.

Writing portable code

  • Use the default budget (16384) or larger, for example push({ budget: 65536 }).
  • To cancel before anything is read, pass the signal to the consumer (text(src, { signal }), pipeTo(..., { signal })). Both reject on every version. Alternatively, wrap pull() in try.
  • With pipeToSync() into a writer that may not close synchronously, consume the readable side and be ready for either a return value or ERR_INVALID_STATE.
  • Restrict shareSync() to 'strict' or 'drop-oldest'.
  • Feature-detect the newer behavior with try { push({ budget: 1 }) } catch { /* v24-style */ }, or check typeof dump === 'function' on the module namespace (both came in v26.12.0).

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts5d3 checks · Risk SAFE
  • Gen Agent Trust Hub5d

    The skill provides technical documentation and examples for the experimental Node.js stream/iter API. It does not perform network operations, access sensitive files, or execute remote code. It follows security best practices by recommending byte limits for untrusted input processing.

  • Socket5d

    No alerts

  • Snyk5d

    Risk: LOW · No issues

Signed by skilld at 5f83e6c. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 5 days ago.

Activeupdated last week

README badge

README badge for jasnell/node-skills/node-stream-iter