Skip to main content

Module stream_promises

Module stream_promises 

Source
Expand description

Node stream/promises module: the Promise-based finished and pipeline.

require('stream/promises') exposes promise-returning versions of stream.finished and stream.pipeline. Rather than duplicate the listener bookkeeping already in stream.rs, each wraps the callback-based require('stream') free function in a Promise — the same compile-a-JS-factory technique util.promisify uses (crate::compile_completion + load_merged + host::run_chunk_on, then invoke the factory).

The returned promise is a REAL pending promise: stream.finished(stream, cb) registers listeners and drains its callback on the first terminal event (end/finish/close) or on error, at which point the callback settles the promise. A stream that has ALREADY reached a terminal state settles immediately (the callback-based finished fires synchronously in that case). No faked resolution — a stream that never terminates leaves the promise pending, exactly as Node does.

Constants§

METHODS
stream/promises module free-functions routed through stdlib::call.

Functions§

call
stdlib::call entry for stream/promises.<method>.
is_method
True if name is a stream/promises free function (for the parent’s is_method wiring).