- From: Noam Rosenthal <notifications@github.com>
- Date: Sun, 30 Apr 2023 22:50:20 -0700
- To: whatwg/fetch <fetch@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/fetch/pull/1614/review/1407367737@github.com>
@noamr commented on this pull request. > - <p class=warning>A standard that uses this argument cannot operate on <a for=/>response</a>'s - <a for=response>body</a> itself as providing this argument will cause it to be read and it can be - read only once. + <p>In some cases, for example when playing video or progressively loading images, clients might + want to stream the response, and process it one chunk at a time. The <a for=/>response</a> is + handed over to the Fetch caller once the headers are processed, and the caller + continues from there. + + <p>To process a <a for=/>response</a> chunk-by-chunk, pass an algorithm to the + <a for=fetch><i>processResponse</i></a> argument of <a for/>fetch</a>. The given + algorithm is passed a <a for=/>response</a> when the response's headers have been + received and is responsible for reading the <a for=/>response</a>'s + <a for=response>body</a>'s <a for=body>stream</a> in order to download the rest + of the response. For convenience, you may also pass an algorithm to the + <a for=fetch><i>processResponseEndOfBody</i></a> argument, which is called once you have finished + obtaining the response and its <a for=response>body</a>. Note that unlike Yea I also wasn't so much into "obtain". @annevk are you ok with "fully reading"? -- Reply to this email directly or view it on GitHub: https://github.com/whatwg/fetch/pull/1614#discussion_r1181404695 You are receiving this because you are subscribed to this thread. Message ID: <whatwg/fetch/pull/1614/review/1407367737@github.com>
Received on Monday, 1 May 2023 05:50:25 UTC