gossamer/writable_stream/writer
Types
A locked writer over a WritableStream.
See WritableStreamDefaultWriter on MDN.
pub type Writer(a)
Values
pub fn abort(
writer: Writer(a),
reason reason: r,
) -> promise.Promise(Result(Nil, js_error.JsError))
Aborts the stream. Returns an error if the underlying sink’s abort callback throws or returns a rejecting promise.
pub fn close(
writer: Writer(a),
) -> promise.Promise(Result(Nil, js_error.JsError))
Closes the stream after all writes complete. Returns an error if the underlying sink’s close callback throws or returns a rejecting promise.
pub fn closed(
of writer: Writer(a),
) -> promise.Promise(Result(Nil, js_error.JsError))
Resolves when the stream closes. Returns an error if the stream errored or the writer was released.
pub fn desired_size(of writer: Writer(a)) -> Result(Int, Nil)
The desired size to fill the stream’s internal queue. Returns an error if the stream has been closed or errored.
pub fn ready(
of writer: Writer(a),
) -> promise.Promise(Result(Nil, js_error.JsError))
Resolves when the stream is ready to accept more writes (backpressure has cleared). Returns an error if the stream errored.
pub fn release_lock(
writer: Writer(a),
) -> Result(Writer(a), js_error.JsError)
Releases the writer’s lock on the stream. Returns an error if there are outstanding writes.
pub fn write(
to writer: Writer(a),
chunk chunk: a,
) -> promise.Promise(Result(Nil, js_error.JsError))
Writes chunk to the stream. Returns an error if the stream errored
or was closed.