Skip to content

ReadableStream.from() rejects sync iterables such as strings (Node accepts them) #35611

Description

@bartlomieju

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions