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’spullcallback is driven synchronously fromreader.read()when the internal queue is empty. Ifpullenqueues (the common case) theread()promise resolves immediately; if the queue stays empty (a controller-fed stream such as aTransformStream’s readable) a genuine pending promise is returned and settled when a laterenqueue,closeorerroroccurs. This makes the queue/close/error data semantics correct even though timing is synchronous. pipeTo/pipeThrough/teedrain their source synchronously. An asynchronous-onlypull(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 aBuiltin(name)viaconstantand constructs viaconstruct. - COMPRESSION_
STREAM_ TAG - COUNT_
STRATEGY_ TAG - DECOMPRESSION_
STREAM_ TAG - METHODS
stream/webexports 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 everystream/webclass.Noneifnameis 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/webnative instance. - is_
class - True if
nameis one of thestream/webclass constructors. - methods_
for - The method list for a
stream/webtag (forinstance_has_method).