Skip to main content

Module stream_web

Module stream_web 

Source
Expand description

Node stream/web module: the WHATWG Streams API over the host object heap.

Every stream, reader, writer and controller is an @@native-tagged JsObj::Object; all internal state (queues, lock flags, callbacks, promises) lives in hidden @@-prefixed props. There is no real backpressure scheduler in this runtime, so the data-flow is modelled synchronously:

  • A ReadableStream’s pull callback is driven synchronously from reader.read() when the internal queue is empty. If pull enqueues (the common case) the read() promise resolves immediately; if the queue stays empty (a controller-fed stream such as a TransformStream’s readable) a genuine pending promise is returned and settled when a later enqueue, close or error occurs. This makes the queue/close/error data semantics correct even though timing is synchronous.
  • pipeTo / pipeThrough / tee drain their source synchronously. An asynchronous-only pull (one that resolves a promise and enqueues later, with nothing on the queue) is treated as end-of-stream by those operations — the one place the synchronous model diverges from spec timing (documented, not faked: no chunk is invented).

Symbol.asyncIterator on a ReadableStream is DEFERRED: the host does not support async-iterator discovery on native objects. getReader().read() is the fully-working consumption path.

Constants§

BYTE_LENGTH_STRATEGY_TAG
CLASSES
The classes exported by require('stream/web'). Each resolves to a Builtin(name) via constant and constructs via construct.
COMPRESSION_STREAM_TAG
COUNT_STRATEGY_TAG
DECOMPRESSION_STREAM_TAG
METHODS
stream/web exports no free functions — everything is a class/constructor.
READABLE_STREAM_METHODS
READABLE_STREAM_TAG
RS_BYOB_READER_METHODS
RS_BYOB_READER_TAG
RS_BYOB_REQUEST_METHODS
RS_BYOB_REQUEST_TAG
RS_BYTE_CONTROLLER_METHODS
RS_BYTE_CONTROLLER_TAG
RS_DEFAULT_CONTROLLER_METHODS
RS_DEFAULT_CONTROLLER_TAG
RS_DEFAULT_READER_METHODS
RS_DEFAULT_READER_TAG
STRATEGY_METHODS
TEXT_DECODER_STREAM_TAG
TEXT_ENCODER_STREAM_TAG
TRANSFORM_STREAM_TAG
TS_DEFAULT_CONTROLLER_METHODS
TS_DEFAULT_CONTROLLER_TAG
WRITABLE_STREAM_METHODS
WRITABLE_STREAM_TAG
WS_DEFAULT_CONTROLLER_METHODS
WS_DEFAULT_CONTROLLER_TAG
WS_DEFAULT_WRITER_METHODS
WS_DEFAULT_WRITER_TAG

Functions§

constant
require('stream/web').<Class> → the constructor value.
construct
new <Class>(...) for every stream/web class. None if name is not ours.
construct_compression
new CompressionStream(format) — format ∈ {gzip, deflate, deflate-raw}.
construct_readable
new ReadableStream(underlyingSource, strategy).
construct_strategy
construct_text_decoder_stream
construct_text_encoder_stream
construct_transform
new TransformStream(transformer, writableStrategy, readableStrategy).
construct_writable
new WritableStream(underlyingSink, strategy).
instance_call
Method dispatch for every stream/web native instance.
is_class
True if name is one of the stream/web class constructors.
methods_for
The method list for a stream/web tag (for instance_has_method).