WritableStream

The WritableStream interface is a part of the Streams API that provides a standardized way to write streaming data to a sink (destination). It comes with its own queuing and backpressure mechanism to ensure that the data is written in an efficient way.

Constructor

WritableStream() Creates a new writable object.

Instance properties

WritableStream.locked A boolean indicating whether the WritableStream is locked to a writer.

Instance methods

WritableStream.abort() Aborts the stream, signaling that the producer can no longer successfully write to the stream and it’s to be immediately moved to an error state, with any queued writes discarded.

WritableStream.close() Closes the stream.

WritableStream.getWriter() 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.

For more information on WritableStream visit MDN Web Docs.


Contributors