This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
It's currently implemented in preview ver. https://dvcs.w3.org/hg/streams-api/raw-file/tip/preview.html ByteStreamReadResult.data is a Promise when no data synchronously readable. Otherwise, data is actual data. This is inspired by e.g. Chrome's network stack code (ERR_IO_PENDING). ---- It's efficient, but I got feedback against this from Elliott. Quoting. - It's really weird that sometimes this thing is a Promise and sometimes it isn't. - It also doesn't make sense that the data property is a Promise since the size and eof properties cannot be known until the promise is resolved so we might as well return Promise<Result> instead of a Result with a Promise property and a size/eof property external to it. - Having the value jump between Promise and real data based on network latency is going to be very error prone for authors, you can probably write your code all one way if your network is fast and then see it fail when sometimes it's slower. - I'd suggest always returning a Promise and dealing with it at microtask time for the "synchronous" case.
One more feedback from Google Maps developer against sync/async hybrid method. I'd like to revert this back to always Promise approach.
Revert committed. Now read/pipe methods always return Promises again. https://dvcs.w3.org/hg/streams-api/raw-file/tip/preview.html
Preview ver merged into ED