#1236: Other Spec Review: `textStream()` for `Blob` and `Body`

Visit on Github

Opened Jun 9, 2026

Specification

https://fetch.spec.whatwg.org/#dom-body-textstream and https://w3c.github.io/FileAPI/#text-stream-method-algo

Explainer

No response

Links

  • Previous early design review, if any: N/A
  • An introduction to the feature, aimed at unfamiliar audiences: A small ergonomic fix for making it easier to stream UTF-8 text without having to create pipes with the stream APIs
  • A description of the problems that end-users were facing before this proposal: it's a small dev ergonomics fix- Web Platform Tests: https://wpt.fyi/results/?label=master&label=experimental&aligned&q=textStream

The specification

Where and by whom is the work is being done?

  • GitHub repo: github.com/whatwg/fetch
  • Primary contacts: @noamr (Google)
  • Organization/project driving the specification: Google
  • This work is being funded by:
  • Primary standards group developing this feature: WHATWG/W3C
  • Group intended to standardize this work: <!-- if different from the current group -->
  • Incubation and standards groups that have discussed the design: WHATWG/W3C

Feedback so far

You should also know that...

Opening this issue as an FYI for TAG in case other specs that have some ergonomic on top of streams (like the ones patched here) need to be considered as well.

<!-- Content below this is maintained by @w3c-tag-bot -->

Track conversations at https://tag-github-bot.w3.org/gh/w3ctag/design-reviews/1236

Discussions

Log in to see TAG-private discussions.

Discussed Jun 22, 2026 (See Github)

Dan: Worked on this with Luke and Lola; will work up a comment.

Discussed Jun 29, 2026 (See Github)

(Skipped.)

Discussed Jul 6, 2026 (See Github)

Dan: I had posted a response that Luke and I worked on. I don't think we have anything more to say about it and would close as satisfied. Will do that after this call.

Comment by @dandclark Jul 7, 2026 (See Github)

Thanks for filing this. We did see a few other places where something like this API could be useful.

  • WebSerial's SerialPort has a property returning ReadableStream?. Examples in the spec even show that being piped through a TextDecoderStream. So a readableTextStream property directly returning the decoded stream could make sense there.
  • WebTransport also has examples using TextDecoderStream. A similar method could be useful there as well.
  • We agree that isn't needed for PushMessageData. There might be an argument from consistency that it should be added there, but PushMessageData doesn't have a stream() method either, and one can just do pushMessageData.blob().textStream() getting essentially the same ergonomics.

But thinking more holistically, is there any reason to not just add this convenience to ReadableStream itself? Then instead of peppering utility methods throughout APIs like WebSerial, instead you'd just have serialPort.readable?.asText() etc. (Regardless of whether this is done though we think textStream() still makes sense on Blob and Body as an additional shortcut).

Comment by @noamr Jul 8, 2026 (See Github)

@dandclark yea it would be great to add it to those as well. Note that this kind of method would only work for raw byte streams so Ij wouldn't include it in ReadableStream. But perhaps all these inferfaces could share a ReadableByteStreamMixin of sorts

Comment by @dandclark Jul 8, 2026 (See Github)

A shared ReadabyleByteStreamMixin could work but loses the ability to choose a specific name which might be appropriate in some spots, for example a different name would probably fit better for WebSerial. This could be decided at the time that such a method is added though.

Thanks @noamr for bringing this to the TAG and thanks @lukewarlow for contributing to this review!