Streams

Streams Standard A readable byte-data source that supports backpressure and piping.

Module: whatwg.streams Support: Experimental Since: 1.1.0 Docs: WHATWG Docs

Interface ReadableStream

A readable byte-data source that supports backpressure and piping.

Since: 1.1.0 Docs: WHATWG Docs

7 members: 7 undocumented

Constructors

⚪ constructor(underlyingSource, strategy)
object, QueuingStrategy

Methods

⚪ cancel(reason)
→ Promise
⚪ getReader(options)
→ ReadableStreamDefaultReader
⚪ pipeThrough(transform, options)
Pipes this stream through a transform and returns the transform's readable side.
⚪ pipeTo(destination, options)
→ Promise
⚪ tee()
→ sequence

Properties

⚪ locked
→ boolean

---

Details

getReader(options)

getReader(options?: any): ReadableStreamDefaultReader

getReader(options?: any): ReadableStreamDefaultReader

Returns: ReadableStreamDefaultReader A ReadableStreamDefaultReader locked to this stream. Throws:
  • TypeError --- If the stream is already locked.

---

Dictionary ReadableWritablePair

Pipes this stream through a transform and returns the transform's readable side.

2 members: 2 undocumented

Properties

⚪ readable
A pair of connected readable and writable streams, typically the two sides
⚪ writable
The readable side of the transform.

---

Dictionary StreamPipeOptions

Pipes this stream through a transform and returns the transform's readable side.

4 members: 4 undocumented

Properties

⚪ preventClose
If true, the destination is not closed when the source closes.
⚪ preventAbort
If true, the destination is not aborted when the source errors.
⚪ preventCancel
If true, the source is not cancelled when the destination errors.
⚪ signal
If true, the source is not cancelled when the destination errors.

---

Interface ReadableStreamDefaultReader

5 members: 5 undocumented

Constructors

⚪ constructor(stream)
ReadableStream

Methods

⚪ read()
→ Promise
⚪ releaseLock()
Releases the reader's lock on the stream.
⚪ cancel(reason)
→ Promise

Properties

⚪ closed
Options controlling how close, abort, and cancel signals propagate between

---

Dictionary ReadableStreamReadResult

2 members: 2 undocumented

Properties

⚪ value
The result of a reader's `read()` call, containing the next chunk value or
⚪ done
The result of a reader's `read()` call, containing the next chunk value or

---

Interface ReadableStreamDefaultController

The default controller for a ReadableStream, used inside the underlying source callbacks.

Since: 1.1.0 Docs: WHATWG Docs

4 members: 4 undocumented

Methods

⚪ close()
Closes the stream; no more chunks can be enqueued after this.
⚪ enqueue(chunk, options)
any, object
⚪ error(e)
any

Properties

⚪ desiredSize
How much additional data the stream can accept; null if the stream is closed or errored.

---

Interface ReadableStreamBYOBReader

A BYOB reader that reads data into caller-provided buffers.

Since: 1.1.0 Docs: WHATWG Docs

5 members: 5 undocumented

Constructors

⚪ constructor(stream)
ReadableStream

Methods

⚪ read(view)
→ Promise
⚪ releaseLock()
Releases the reader's lock on the stream.
⚪ cancel(reason)
→ Promise

Properties

⚪ closed
Options controlling how close, abort, and cancel signals propagate between

---

Interface ReadableByteStreamController

The controller for byte-oriented ReadableStreams (type: "bytes").

Since: 1.1.0 Docs: WHATWG Docs

5 members: 5 undocumented

Methods

⚪ close()
Closes the stream; no more chunks can be enqueued after this.
⚪ enqueue(chunk)
BufferSource
⚪ error(e)
any

Properties

⚪ byobRequest
The current BYOB request, or null.
⚪ desiredSize
How much additional data the stream can accept; null if the stream is closed or errored.

---

Interface ReadableStreamBYOBRequest

The current BYOB request, or null.

3 members: 3 undocumented

Methods

⚪ respond(bytesWritten)
u64
⚪ respondWithNewView(view)
BufferSource

Properties

⚪ view
→ BufferSource?

---

Interface WritableStream

5 members: 5 undocumented

Constructors

⚪ constructor(underlyingSink, strategy)
object, QueuingStrategy

Methods

⚪ abort(reason)
→ Promise
⚪ close()
Closes the stream; no more chunks can be enqueued after this.
⚪ getWriter()
→ WritableStreamDefaultWriter

Properties

⚪ locked
→ boolean

---

Details

getWriter()

getWriter(): WritableStreamDefaultWriter

getWriter(): WritableStreamDefaultWriter

Returns: WritableStreamDefaultWriter A WritableStreamDefaultWriter locked to this stream. Throws:
  • TypeError --- If the stream is already locked.

---

Interface WritableStreamDefaultWriter

8 members: 8 undocumented

Constructors

⚪ constructor(stream)
WritableStream

Methods

⚪ abort(reason)
→ Promise
⚪ close()
Closes the stream; no more chunks can be enqueued after this.
⚪ releaseLock()
Releases the reader's lock on the stream.
⚪ write(chunk)
Represents a pending BYOB read request from a ReadableStreamBYOBReader.

Properties

⚪ closed
Options controlling how close, abort, and cancel signals propagate between
⚪ desiredSize
How much additional data the stream can accept; null if the stream is closed or errored.
⚪ ready
How many more chunks can be written before backpressure should be applied; null if the stream is closed or errored.

---

Interface WritableStreamDefaultController

The controller for a WritableStream, used inside the underlying sink callbacks.

Since: 1.1.0 Docs: WHATWG Docs

2 members: 2 undocumented

Methods

⚪ error(e)
any

Properties

⚪ signal
If true, the source is not cancelled when the destination errors.

---

Interface TransformStream

A pair of a WritableStream and a ReadableStream that together form a pipe transformer.

Since: 1.1.0 Docs: WHATWG Docs

3 members: 3 undocumented

Constructors

⚪ constructor(transformer, writableStrategy, readableStrategy)
object, QueuingStrategy, QueuingStrategy

Properties

⚪ readable
A pair of connected readable and writable streams, typically the two sides
⚪ writable
The readable side of the transform.

---

Interface TransformStreamDefaultController

The controller for a TransformStream, used inside the transformer callbacks.

Since: 1.1.0 Docs: WHATWG Docs

4 members: 4 undocumented

Methods

⚪ enqueue(chunk)
any
⚪ error(reason)
any
⚪ terminate()
Closes the readable side of the stream.

Properties

⚪ desiredSize
How much additional data the stream can accept; null if the stream is closed or errored.

---

Dictionary QueuingStrategy

2 members: 2 undocumented

Properties

⚪ highWaterMark
The total queue size at which backpressure is applied.
⚪ size
A strategy for controlling backpressure in a stream, specifying a high-water mark

---

Callback QueuingStrategySize

A callback returning the size of a given chunk for backpressure calculations.

---

Interface CountQueuingStrategy

A queuing strategy that counts the number of chunks regardless of their size.

Since: 1.1.0 Docs: WHATWG Docs

3 members: 3 undocumented

Constructors

⚪ constructor(init)
QueuingStrategyInit

Properties

⚪ highWaterMark
The total queue size at which backpressure is applied.
⚪ size
A strategy for controlling backpressure in a stream, specifying a high-water mark

---

Interface ByteLengthQueuingStrategy

A queuing strategy that measures backpressure by summing chunk byte lengths.

Since: 1.1.0 Docs: WHATWG Docs

3 members: 3 undocumented

Constructors

⚪ constructor(init)
QueuingStrategyInit

Properties

⚪ highWaterMark
The total queue size at which backpressure is applied.
⚪ size
A strategy for controlling backpressure in a stream, specifying a high-water mark

---

Dictionary QueuingStrategyInit

1 members: 1 undocumented

Properties

⚪ highWaterMark
The total queue size at which backpressure is applied.

---