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

    Interface Sink<V, R>

    Terminal operation applied to a feed.

    A sink consumes the items of a Feed, driving the pipe that feeds it and computing the final result; one able to decide its outcome early may stop consuming before the source runs dry.

    Stating the item type alone, as Sink<V>, names any sink drawing V items whatever it resolves to, so sinks are held together under a common type or handed over as arguments with no result to agree on. A pipe closed by a sink declared that way resolves to unknown: state the result type wherever it is meant to be read.

    The sink draws from a feed, so it may either iterate it with for await or compose it with further tasks and sinks, delegating the whole computation or part of it to operations already available.

    Caution

    The feed handed over must be assumed to be drained by a single pass.

    Type Parameters

    • V

      The type of items drawn from the feed

    • R = unknown

      The type of result computed over the items, defaulting to unknown for sinks whose result is of no interest

    • Consumes the items.

      Parameters

      • feed: Feed<V>

        The feed carrying the items to consume

      Returns Promise<R>

      A promise resolving to the final result