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

    Function toArray

    • Creates a sink collecting the items of the feed into an array.

      Items are collected in source order and the array is made immutable once the feed is drained, freezing it together with the items collected into it.

      Warning

      • Exhaustive: every item is collected before the sink resolves, so an infinite feed never completes.
      • Materialising: the whole feed is held in memory, so a large feed may exhaust it.
      • Stateful: the array covers the items drawn, so a sink closing a nested or truncated feed sees those alone.
      Warning

      Freezing clones structured items, giving them a fresh identity: entries are not reachable through the original item reference. Supply structured items as immutable values to keep their identity stable.

      Type Parameters

      • V

        The type of items in the feed

      Returns Sink<V, readonly V[]>

      A sink resolving to the deeply immutable read-only array of the items of the feed

      await pipe(
      (items([1, 2, 3]))
      (toArray())
      ); // [1, 2, 3]