Re: [whatwg/fetch] Add a textStream() method to the Body mixin (PR #1862)

@MattiasBuelens commented on this pull request.



> @@ -8246,6 +8250,20 @@ of running <a for=Body>consume body</a> with <a>this</a> and <a>parse JSON from
 of running <a for=Body>consume body</a> with <a>this</a> and <a>UTF-8 decode</a>.
 </div>
 
+<div algorithm>
+<p>The <dfn method for=Body><code>textStream()</code></dfn> method steps are:</p>
+
+<ol>
+ <li><p>If <span>this</span>'s <a for=Body>body</a> is null, throw a {{TypeError}}.
+
+ <li><p>Let <var>stream</var> be <a>this</a>'s <a for=Body>body</a>'s <a for=body>stream</a>.
+
+ <li><p>Let <var>decoder</var> be a new {{TextDecoderStream}} object.
+
+ <li><p>Return the result of piping <var>stream</var> through <var>decoder</var>.

You should be able to use the [pipe through](https://streams.spec.whatwg.org/#readablestream-pipe-through) algorithm exposed for other specifications. 😉

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/pull/1862#discussion_r2399855684
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/fetch/pull/1862/review/3296096375@github.com>

Received on Thursday, 2 October 2025 19:24:46 UTC