@metreeca/flow - v0.10.0
    Preparing search index...

    Interface Feed<V>

    Async sequence of items.

    A feed is called to advance the pipe: with a Task to obtain a new feed carrying the transformed items, or with a Sink to consume it and obtain the final result. A caller preferring to drive the pipe itself iterates the feed with for await. Composition is lazy, as nothing is drawn from the source until a sink or an iteration consumes the feed.

    A feed ends when the source it draws from stops yielding items: an array, a generator object or another feed ends it on its own under the iteration protocols. A source producing one value per call, a polling function for instance, is bounded by the feed it is opened with, either reporting an end marker as inlet accepts or wrapped in a generator of its own, while a source genuinely without end is bounded downstream, with a task such as take or with a sink deciding its outcome early.

    A feed is replayable only as far as its source is: one opened over a repeatable source, an array or a set among them, carries the same items at each pass, while one opened over a source drained by iteration is empty after the first. A feed handed to a Task or a Sink, and one a task reports, is drained by a single pass whatever it draws from, so a pipe is replayed by composing it afresh from the feed it opens with.

    Type Parameters

    • V

      The type of items carried by the feed

    Hierarchy

    • AsyncIterable<V>
      • Feed
    • Applies a transformation task to the feed.

      Type Parameters

      • R

        The type of items task reports

      Parameters

      • task: Task<V, R>

        The task to apply

      Returns Feed<R>

      A new feed carrying the items task reports

    • Applies a terminal sink to the feed.

      Type Parameters

      • R

        The type of result sink computes

      Parameters

      • sink: Sink<V, R>

        The sink to apply

      Returns Promise<R>

      A promise resolving to the result sink computes over the items