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

@noamr 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.

How deep does this need to go? Seems like the internal algorithms in the encoding spec operate on a `TextDecoderStream` object rather than on an internal representation which can make this into quite a big yak shaving for a small ergonomic API addition. 

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

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

Received on Tuesday, 19 May 2026 10:55:37 UTC