ReadableStream

open class ReadableStream<R : JsAny?>(    underlyingSource: UnderlyingByteSource,     strategy: QueuingStrategy<R> = definedExternally) : Transferable, AsyncIterable<R> (source)

The ReadableStream interface of the Streams API represents a readable stream of byte data.

MDN Reference

Constructors

Link copied to clipboard
constructor(underlyingSource: UnderlyingDefaultSource<R>, strategy: QueuingStrategy<R> = definedExternally)
constructor(underlyingSource: UnderlyingSource<R> = definedExternally, strategy: QueuingStrategy<R> = definedExternally)
constructor(underlyingSource: UnderlyingByteSource, strategy: QueuingStrategy<R> = definedExternally)

Properties

Link copied to clipboard

The locked read-only property of the ReadableStream interface returns whether or not the readable stream is locked to a reader.

Functions

Link copied to clipboard
suspend fun cancel(reason: JsError? = definedExternally)

The cancel() method of the ReadableStream interface returns a Promise that resolves when the stream is canceled.

Link copied to clipboard
fun cancelAsync(reason: JsError? = definedExternally): Promise<Void>
Link copied to clipboard
open operator fun get(key: Symbol.asyncIterator): () -> AsyncIterator<R>
Link copied to clipboard

The getReader() method of the ReadableStream interface creates a reader and locks the stream to it.

Link copied to clipboard
open inline operator fun iterator(): SuspendableIterator<R>
Link copied to clipboard
fun <T : JsAny?> pipeThrough(transform: ReadableWritablePair<T, R>, options: StreamPipeOptions = definedExternally): ReadableStream<T>

The pipeThrough() method of the ReadableStream interface provides a chainable way of piping the current stream through a transform stream or any other writable/readable pair.

Link copied to clipboard
suspend fun pipeTo(destination: WritableStream<R>, options: StreamPipeOptions = definedExternally)

The pipeTo() method of the ReadableStream interface pipes the current ReadableStream to a given WritableStream and returns a Promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered.

Link copied to clipboard
fun pipeToAsync(destination: WritableStream<R>, options: StreamPipeOptions = definedExternally): Promise<Void>
Link copied to clipboard

The tee() method of the two-element array containing the two resulting branches as new ReadableStream instances.

Link copied to clipboard
fun values(options: ReadableStreamIteratorOptions = definedExternally): AsyncIterator<R>