JSWritableStream extension

Provides a standard abstraction for writing streaming data to a destination, known as a sink. This object comes with built-in backpressure and queuing.

Example and more on MDN Web Docs

on

Properties

locked bool

Available on WritableStream, provided by the JSWritableStream extension

Indicates whether or not the writable stream is locked.
no setter

Methods

abort([String? reason]) Future<void>

Available on WritableStream, provided by the JSWritableStream extension

Aborts the stream, signaling that the producer can no longer successfully write to the stream and it is to be immediately moved to an error state, with any queued writes discarded.
close() Future<void>

Available on WritableStream, provided by the JSWritableStream extension

Closes the stream.
getWriter() WritableStreamDefaultWriter

Available on WritableStream, provided by the JSWritableStream extension

Returns a new instance of WritableStreamDefaultWriter and locks the stream to that instance. While the stream is locked, no other writer can be acquired until this one is released.