whatwg / streams

Streams Standard
https://streams.spec.whatwg.org/
Other
1.34k stars 155 forks source link

read all bytes: Why only Uint8Array instead of general BufferSource? #1299

Open saschanaz opened 7 months ago

saschanaz commented 7 months ago

What is the issue with the Streams Standard?

I just found that the chunk steps of read all bytes requires Uint8Array:

chunk steps, given chunk

  1. If chunk is not a Uint8Array object, call failureSteps with a TypeError and abort these steps.

Maybe it can be BufferSource instead?

(Context: Given this algorithm is implemented in Gecko as a pipe to internal output stream, I was investigating whether the code for WebTransport write could be reused here. WT accepts BufferSource which makes more sense to me.)