Skip to main content

Module stream

Module stream 

Source
Expand description

Node stream module: native base classes + module helper functions.

The base classes (Readable/Writable/Duplex/Transform/PassThrough/ Stream) are EventEmitter-backed objects (same @@native/@@on/@@once shape as net sockets) exposing the surface higher layers touch today: on/once/emit, write/end, push/read, and a best-effort pipe. http’s req/res are their own native objects (see http.rs); this module exists so require('stream') yields the base constructors and the module helper functions (finished, pipeline, isReadable, …).

Lifecycle state is tracked with hidden boolean props set as terminal events fire: @@ended (readable end), @@finished (writable finish), @@destroyed (close/destroy), @@errored (error value), @@disturbed (read/resume/pipe). finished(stream, cb) callbacks live in a @@finished array drained on the first terminal event so the callback fires exactly once.

Constants§

CLASSES
The base classes exported by require('stream').
METHODS
The module free-functions exported by require('stream').
STATIC_METHODS
Statics on the stream CONSTRUCTORS (Readable.from, not stream.from).

Functions§

call
Module free-function dispatch (stream.finished, stream.isReadable, …).
constant
stream.<Class> property (a constructor value), reachable via namespace_property → stdlib::constant.
construct
new Readable() / Writable / Duplex / Transform / PassThrough / Stream.
flush_from
Drain a Readable.from queue: one data per item, then end.
instance_call
Instance dispatch for a stream base class. EventEmitter methods are delegated to events; emit routes through emit_event for lifecycle tracking.
is_class
True if name is one of the stream base-class constructors.
static_call
Readable.from(iterable) / Duplex.from(iterable).
transform_callback
The callback a transform implementation invokes: cb(err, chunk). A nullish chunk contributes nothing, matching push(null)-style suppression.