-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace createWriter, FileSystemWriter with createWritable, WritableFileStream #62
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a good start, although I do wonder about the exact API shape in a number of places.... Interested to hear what domenic's thoughts are.
index.bs
Outdated
|
||
<xmp class=idl> | ||
[Exposed=(Window,Worker), SecureContext] | ||
interface FileSystemWriter { | ||
interface FileSystemWritableFileStream : WritableStream { | ||
Promise<void> write(unsigned long long position, (BufferSource or Blob or USVString) data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You shouldn't define write() and close(); users should call those via the writer.
To customize the behavior of the writer, instead you need to define (in the definition of createWritable) what the underlying sink algorithms are. See https://fetch.spec.whatwg.org/#concept-construct-readablestream and its call sites for some rough guidance (although that's for readable; for writable you'd be using https://streams.spec.whatwg.org/#create-writable-stream).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think of defining write()
and truncate()
, so that FileSystemWritableFileStream
can be used directly?
For instance, one could do:
const stream = await handle.createWritable();
await stream.write(new Blob(['foo']); // New method, peer to `seek` and `truncate`.
await stream.close(); // Overrided method from WritableStream.
At the same time, the underlying sink algorithms will be implemented to accept WriteParams
to execute commands, or to take byte-like data.
edec226
to
5892f07
Compare
…ileStream This adds specs for `WritableFileStream` and options. It links to `WritableStreams` related specs, with an inheritance relationship.
5892f07
to
7f9fa0d
Compare
Closes #19 |
This adds specs for
WritableFileStream
and the factory and options.It links to
WritableStreams
related specs, with an inheritancerelationship.
Preview | Diff