Skip to content

fetch: ReadableStream in body #1072

@benmccann

Description

@benmccann

Description

Allow using a ReadableStream in the body for fetch. Ideally for both the request and response bodies

Specification

https://fetch.spec.whatwg.org/

web-feature

https://web-platform-dx.github.io/web-features-explorer/features/fetch-request-streams/

Test Links

No response

Additional Signals

I have personally run into the lack of this API as being burdensome as a maintainer of SvelteKit where we implemented "remote functions" (RPCs) and as a maintainer of Immich where we implemented progress tracking for uploads and downloads of photos. We've had to do workarounds using XMLHttpRequest instead of fetch as a result: https://github.com/immich-app/immich/blob/17bbcdf58418b3168f05b4b7aea5912129d86c54/web/src/lib/utils.ts#L85

The lack of this feature is a major driver for adoption of the axios data fetching library, so as a result more bytes get sent to the client as axios must be sent across the wire rather than relying on the platform.

Implemented in a number of platforms: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API#browser_compatibility

Missing from Firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=1387483

$15,000 bounty for the feature in webkit: WebKit/standards-positions#24 (comment)

A sample of representative StackOverflow posts on the topic:

A number of likes and responses here: https://bsky.app/profile/benmccann.com/post/3lxdgi2kb2s25

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions