Deno: 2.9.0 (stable, aarch64-apple-darwin) · Node (for comparison): v26.3.0 · found running the fastify suite under deno test (fastify/fastify#6804).
ReadableStream.from() rejects sync iterables such as strings (Node accepts them)
ReadableStream.from(iterable) should accept any sync iterable (per the WHATWG streams from definition). A string is a sync iterable. Node accepts it; Deno throws.
Reproduction
const rs = ReadableStream.from('hi')
const { value } = await rs.getReader().read()
console.log('first chunk:', JSON.stringify(value))
- Node:
first chunk: "h"
- Deno:
TypeError: Failed to execute 'ReadableStream.from': Argument 1 can not be converted to async iterable
Why it matters
Surfaced in fastify's HEAD-route response-type test, which returns ReadableStream.from('...'). More broadly, any sync-iterable input (strings, arrays, Sets) should be accepted.
Deno: 2.9.0 (stable, aarch64-apple-darwin) · Node (for comparison): v26.3.0 · found running the fastify suite under
deno test(fastify/fastify#6804).ReadableStream.from()rejects sync iterables such as strings (Node accepts them)ReadableStream.from(iterable)should accept any sync iterable (per the WHATWG streamsfromdefinition). A string is a sync iterable. Node accepts it; Deno throws.Reproduction
first chunk: "h"TypeError: Failed to execute 'ReadableStream.from': Argument 1 can not be converted to async iterableWhy it matters
Surfaced in fastify's HEAD-route response-type test, which returns
ReadableStream.from('...'). More broadly, any sync-iterable input (strings, arrays, Sets) should be accepted.