Stream<T> — the real-time primitive every hoodkit stream returns.
It is BOTH:
an event emitter: stream.on('data', cb), .on('error', cb), .on('close', cb);
a backpressure-safe async iterable: for await (const v of stream) { ... }.
The two forms share one source. Event listeners fire synchronously as values
arrive (no buffering — a slow listener never grows memory). The async-iterator
form buffers into a bounded queue and applies an explicit overflow policy so a
slow consumer degrades predictably instead of leaking memory:
'drop-oldest' (default): keep the newest highWaterMark values, dropping the
oldest and counting them in Stream.dropped. Right for firehose-style feeds.
'latest': keep only the single most-recent value. Right for price ticks where
only the current price matters.
'block': never drop; the buffer grows unbounded. Use only when the producer is
naturally slow (e.g. a 1s price poll) or the consumer is guaranteed to keep up.
Stream<T>— the real-time primitive everyhoodkitstream returns.It is BOTH:
stream.on('data', cb),.on('error', cb),.on('close', cb);for await (const v of stream) { ... }.The two forms share one source. Event listeners fire synchronously as values arrive (no buffering — a slow listener never grows memory). The async-iterator form buffers into a bounded queue and applies an explicit overflow policy so a slow consumer degrades predictably instead of leaking memory:
'drop-oldest'(default): keep the newesthighWaterMarkvalues, dropping the oldest and counting them in Stream.dropped. Right for firehose-style feeds.'latest': keep only the single most-recent value. Right for price ticks where only the current price matters.'block': never drop; the buffer grows unbounded. Use only when the producer is naturally slow (e.g. a 1s price poll) or the consumer is guaranteed to keep up.