Re: [streams] What types does ReadableByteStream's reader's read(x) accept and return? (#295)

A view gives the tuple (buffer, bytesRead, offsetIntoBuffer) which is necessary information anyway if you're reusing buffers. (ReadableByteStreams definitely are used for reusing buffers in the BYOB reader case; for the naive reader case they can't right now, but e.g. #324 would give a mechanism for doing so).

In balance an array buffer view seems better than a custom `{ buffer, bytesRead, offset }` tuple (as Jason convinced me [on es-discuss](https://esdiscuss.org/topic/idiomatic-representation-of-buffer-bytesread)). The choice between DataView and Uint8Array is somewhat arbitrary; I thought Uint8Array would be more likely to be useful since it has all those nice array methods.

---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/issues/295#issuecomment-92385663

Received on Monday, 13 April 2015 14:43:14 UTC