Contact emailsnidh...@google.com, ri...@chromium.org, yhi...@chromium.org
SpecificationStreams API Spec
We will update this thread when our design doc firms up.
The streams APIs provide ubiquitous, interoperable primitives for creating, composing, and consuming streams of data. For streams representing bytes, an extended version of the readable stream is provided to handle bytes efficiently, in particular by minimizing copies.
Byte streams allow for BYOB readers to be acquired. The default implementation can give a range of different outputs such as strings or array buffers in the case of WebSockets, whereas byte streams guarantee byte output. Furthermore, being able to have BYOB readers has benefits in terms of stability. This is because if a buffer detaches, it can guarantee that one does not write into the same buffer twice, hence avoiding race conditions. BYOB readers also do not need to garbage collect for every read, because we can reuse buffers.
Initial public proposalNone
TAG review statusNot applicable
Interoperability and Compatibility
Low risk because it has already been standardised for a long time (since around 2014). Other browsers have implemented other parts of the standard, and they will most likely also adapt byte streams as well soon.Gecko
: No signalWebKit
: No signalWeb developers
: No signals
A lot of design efforts have been made into making the streams API easy to use. Additionally, this byte streams API is similar to the existing streams API that developers are used to.
It is difficult to polyfill just byte streams, without polyfilling the rest of readable streams. Hence, developers may need to wait for other browsers to also implement byte streams, or maintain two code paths.
No special support needed.
Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?Yes. This feature will be purely implemented in Blink and so cross-platform support is automatic.Yes
Link to entry on the Chrome Platform Statushttps://chromestatus.com/feature/4535319661641728