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 good to have a method to allow "passive producer" (which doesn't want to do work until the connected consumer requests data) to wait until the consumer requests data. E.g. random number generator would be categorized into this group. Consider trade-off between advantage of this feature and inflation of API surface.
There is a caveat we need to be careful of. If we allow both - Producer waiting for N bytes available for write - Consumer waiting for M bytes available for read this can result in deadlock. Cf. bulk transfer, TCP's silly window syndrome issue.
Split waiting functionality into a separate method waitForWritable(). It's confusing that write() method has that functionality. It doesn't seem to be worth taking that approach for smaller API surface. For now, include just waitForWritable(undefined). waitForWritable(size) though it might be useful for some cases as explained in Comment 1.
Done in preview ver https://dvcs.w3.org/hg/streams-api/raw-file/tip/preview.html waitForWritable has been added.
It's in ED now. Named awaitSpaceAvailable().