Table of Contents

Class WritableStream

Namespace
CSharpToJavaScript.APIs.JS
Assembly
CSharpToJavaScript.dll

The WritableStream interface of the Streams API provides a standard abstraction for writing streaming data to a destination, known as a sink.
This object comes with built-in backpressure and queuing.

[Value("WritableStream")]
public class WritableStream
Inheritance
WritableStream
Derived
Inherited Members

Remarks

Constructors

WritableStream()

public WritableStream()

WritableStream(Object, QueuingStrategy)

The WritableStream() constructor creates a new WritableStream object instance.

public WritableStream(Object underlyingSink = null, QueuingStrategy strategy = null)

Parameters

underlyingSink Object
strategy QueuingStrategy

Remarks

Properties

Locked

The locked read-only property of the WritableStream interface returns a boolean indicating whether the WritableStream is locked to a writer.

[Value("locked")]
public bool Locked { get; }

Property Value

bool

A boolean value indicating whether or not the writable stream is locked.

Remarks

Methods

Abort(dynamic)

The abort() method of the WritableStream interface 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.

[Value("abort")]
public Task<GlobalObject.Undefined> Abort(dynamic reason = null)

Parameters

reason dynamic

Returns

Task<GlobalObject.Undefined>

A Promise, which fulfills with the value given in the reason parameter.

Remarks

Close()

The close() method of the WritableStream interface closes the associated stream. All chunks written before this method is called are sent before the returned promise is fulfilled.

[Value("close")]
public Task<GlobalObject.Undefined> Close()

Returns

Task<GlobalObject.Undefined>

A Promise which fulfills with the undefined when all
remaining chunks were successfully written before the close, or rejects with an error if
a problem was encountered during the process.

Remarks

This is equivalent to getting a WritableStreamDefaultWriter with GetWriter(), calling Close() on it.

See also on MDN

GetWriter()

The getWriter() method of the WritableStream interface 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.

[Value("getWriter")]
public WritableStreamDefaultWriter GetWriter()

Returns

WritableStreamDefaultWriter

A WritableStreamDefaultWriter object instance.

Remarks