Skip to content

Multiple new stream adapter updates#6081

Open
jasnell wants to merge 4 commits intomainfrom
jasnell/more-new-streams-adapters-tweaks
Open

Multiple new stream adapter updates#6081
jasnell wants to merge 4 commits intomainfrom
jasnell/more-new-streams-adapters-tweaks

Conversation

@jasnell
Copy link
Collaborator

@jasnell jasnell commented Feb 14, 2026

A number of cleanups and more improvements.

For the write adapter, when writing to an internal stream (think fetch, identity transform stream, etc)... we will directly support writing ArrayBuffer, ArrayBufferView, SharedArrayBuffer like we do currently, but we also support writing strings directly (as utf8 bytes) which will avoid hving to create a TextEncoder. And we'll also support writing sync iterables, e.g.

const { writable, readble } = new IdentityTransformStream();

const writer = writable.getWriter();

await writer.write('hello');  // will work

await writer.write(['hello', 'there']);  // will work

function* gen() {
  yield 'hello';
  yield 'world';
}
await writer.write(gen());  // will work

Why you ask? Pretty simple.. writing multiple chunks at once will help avoid the more expensive KJ/JS promise loop.

@jasnell jasnell requested review from a team as code owners February 14, 2026 07:20
@jasnell jasnell changed the title ReadableSourceKjAdapter doc comment updates Multiple new stream adapter updates Feb 14, 2026
Support vectored writes of sync iterables of bytes sources.
@jasnell jasnell force-pushed the jasnell/more-new-streams-adapters-tweaks branch from 7f53d0a to 87a1c98 Compare February 14, 2026 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant