#1236: Other Spec Review: `textStream()` for `Blob` and `Body`
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 aTextDecoderStream. So areadableTextStreamproperty 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
PushMessageDatadoesn't have astream()method either, and one can just dopushMessageData.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!
OpenedJun 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
The specification
Where and by whom is the work is being done?
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