Interface Source<T>

A Source is a function that can be called to arrange for data to be produced and sent to a Sink function for consumption, until the associated Connection is closed (either by the source or the sink, e.g. if the sink doesn't want more data or the source has no more to send).

If the source is a backpressurable stream, it can use the (optional) supplied inlet (usually a throttle()) to rate-limit its output.

A producer function must return the special IsStream value, so TypeScript can tell what functions are usable as sources. (Otherwise any void function with no arguments would appear to be usable as a source!)

interface Source<T> ((sink: Sink<T>, conn?: Connection, inlet?: Throttle | Inlet) => "uneventful/is-stream")

Type Parameters

  • T