- From: Adam Rice <notifications@github.com>
- Date: Wed, 10 Apr 2024 00:03:40 -0700
- To: whatwg/streams <streams@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/streams/pull/1311/review/1990926355@github.com>
@ricea commented on this pull request. Just random comments at the moment, not a full review. > @@ -2661,6 +2688,99 @@ create them does not matter. 1. Return « |branch1|, |branch2| ». </div> +<div algorithm> +To <dfn lt="fully read">fully read</dfn> a {{ReadableStream}} |stream|, given an algorithm |processBody|, and an algorithm |processBodyError|, run these steps. |processBody| must be an algorithm accepting a [=byte sequence=]. |processBodyError| must be an algorithm optionally accepting an exception. + + 1. Let |successSteps| given a [=byte sequence=] |bytes| be to run |processBody| given |bytes|. + 1. Let |errorSteps| optionally given an exception |exception| be to run |processBodyError| given |exception|. + 1. Let |reader| be the result of getting a reader for |stream|. If that threw an exception, then run |errorSteps| with that exception and return. + 1. [=read all bytes|Read all bytes=] from |reader|, given |successSteps| and |errorSteps|. I think Bikeshed can compensate for different capitalisation automatically. > + in |actions|, and with |error|. + 1. If |signal| is [=AbortSignal/aborted=], perform the following steps: + 1. perform |abortAlgorithm|. + 1. return |promise|. + 1. [=AbortSignal/Add=] |abortAlgorithm| to |signal|. + 1. [=fully read=] |stream| given |successSteps|, |errorSteps|, and |stream|’s relevant global object. + 1. Return promise. +</div> + +<div algorithm> + <dfn abstract-op lt="ReadableStreamConsumeAsText" id="ReadableStreamConsumeAsText">ReadableStreamConsumeAsText(|stream|, |options|})</dfn> will + consume all bytes produced by a given readable stream and return a promise that resolves with a string containing the UTF-8-decoded text. + + It performs the following steps: + + 1. Assert: |stream| [=implements=] {{ReadableStream}}. Maybe we could have a `PrepareToConsume` abstract op to encapsulate these common steps? -- Reply to this email directly or view it on GitHub: https://github.com/whatwg/streams/pull/1311#pullrequestreview-1990926355 You are receiving this because you are subscribed to this thread. Message ID: <whatwg/streams/pull/1311/review/1990926355@github.com>
Received on Wednesday, 10 April 2024 07:03:44 UTC