WriteableStream

@native @JSType
trait WriteableStream[-T] extends Object

¶4.2. Class WritableStream of whatwg Stream spec

todo: the constructor

Type parameters:
T

Type of the Chunks to be written to the Stream

class Object
trait Any
class Object
trait Matchable
class Any

Value members

Concrete methods

def abort(reason: UndefOr[Any]): Promise[Unit]

The abort method signals that the producer can no longer successfully write to the stream and it should be immediately moved to an "errored" state, with any queued-up writes discarded. This will also execute any abort mechanism of the underlying sink. see ¶4.2.4.4. abort(reason)

The abort method signals that the producer can no longer successfully write to the stream and it should be immediately moved to an "errored" state, with any queued-up writes discarded. This will also execute any abort mechanism of the underlying sink. see ¶4.2.4.4. abort(reason)

def close(): Promise[WriteableStream[T]]

The close method signals that the producer is done writing chunks to the stream and wishes to move the stream to a "closed" state. This queues an action to close the stream, such that once any currently queued-up writes complete, the close mechanism of the underlying sink will execute, releasing any held resources. In the meantime, the stream will be in a "closing" state.

The close method signals that the producer is done writing chunks to the stream and wishes to move the stream to a "closed" state. This queues an action to close the stream, such that once any currently queued-up writes complete, the close mechanism of the underlying sink will execute, releasing any held resources. In the meantime, the stream will be in a "closing" state.

¶4.2.4.5. close()

Returns:

a promise of this stream being closed

The state getter returns the state of the stream see ¶4.2.4.3. get state of whatwg streams spec

The state getter returns the state of the stream see ¶4.2.4.3. get state of whatwg streams spec

def write(chunk: Chunk[T]): Promise[Any]

The write method adds a write to the stream’s internal queue, instructing the stream to write the given chunk of data to the underlying sink once all other pending writes have finished successfully . It returns a promise that will be fulfilled or rejected depending on the success or failure of writing the chunk to the underlying sink. The impact of enqueuing this chunk will be immediately reflected in the stream’s state property; in particular, if the internal queue is now full according to the stream’s queuing strategy, the stream will exert backpressure by changing its state to "waiting".

The write method adds a write to the stream’s internal queue, instructing the stream to write the given chunk of data to the underlying sink once all other pending writes have finished successfully . It returns a promise that will be fulfilled or rejected depending on the success or failure of writing the chunk to the underlying sink. The impact of enqueuing this chunk will be immediately reflected in the stream’s state property; in particular, if the internal queue is now full according to the stream’s queuing strategy, the stream will exert backpressure by changing its state to "waiting".

see 4.2.4.6. write(chunk) of whatwg streams spec

Returns:

bblfish: not sure what the type of the promise returned is

Inherited methods

def hasOwnProperty(v: String): Boolean
Inherited from:
Object
def isPrototypeOf(v: Object): Boolean
Inherited from:
Object
def propertyIsEnumerable(v: String): Boolean
Inherited from:
Object
def toLocaleString(): String
Inherited from:
Object
def valueOf(): Any
Inherited from:
Object

Concrete fields

val closed: Promise[WriteableStream[T]]

The closed getter returns a promise that will be fulfilled when the stream becomes closed, or rejected if it ever errors. see ¶4.2.4.1. get closed

The closed getter returns a promise that will be fulfilled when the stream becomes closed, or rejected if it ever errors. see ¶4.2.4.1. get closed

val ready: Promise[WriteableStream[T]]

The ready getter returns a promise that will be fulfilled when the stream transitions away from the "waiting" state to any other state. Once the stream transitions back to "waiting", the getter will return a new promise that stays pending until the next state transition. In essence, this promise gives a signal as to when any backpressure has let up (or that the stream has been closed or errored).

The ready getter returns a promise that will be fulfilled when the stream transitions away from the "waiting" state to any other state. Once the stream transitions back to "waiting", the getter will return a new promise that stays pending until the next state transition. In essence, this promise gives a signal as to when any backpressure has let up (or that the stream has been closed or errored).

see ¶4.2.4.2. get ready of whatwg streams spec.