[whatwg/streams] Should we add writableStream.write()? readableStream.read()? (#1072)

I was reviewing https://wicg.github.io/native-file-system/#api-filesystemwritablefilestream, which is one of the the major non-TransformStream users of WritableStream in spec land so far. And I noticed they added a `write()` convenience method that just wraps `this.getWriter().write()` + a release step, similar to the existing `writableStream.close()` and `writableStream.abort()`.

It feels like maybe we're doing something wrong, if specs are subclassing us to add convenience methods in this way. Should we consider adding one-shot writing methods? What about one-shot reading methods?

It *would* be a nice simplification for folks who are just writing simple code and don't need to care about the exclusivity of their writers/readers...

On the other hand, maybe the real issue here is that it's too hard to add convenience methods to the return value of `getWriter()`? Maybe if that were easier, the NativeFS spec would have stuck with the "acquire a writer first" design, and just added the `seek()` and `truncate()` convenience methods to the writer?

/cc @mkruisselbrink

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/issues/1072

Received on Wednesday, 26 August 2020 20:47:49 UTC