Skip to content
PACKAGES

fromAsyncIter()

Read an async iterable: each value → DATA; COMPLETE when done; ERROR on failure. async pool. Optional signal aborts the pump.

import { fromAsyncIter } from "@graphrefly/ts/sources";
function fromAsyncIter(
iterable: AsyncIterable<T>,
opts?: AsyncSourceOpts,
): Operator<never, T>
ParameterTypeDescription
iterableAsyncIterable<T>Async iterable to pump into the graph.
optsAsyncSourceOptsOptional abort signal and async source options.

A source operator that emits every iterable value and then COMPLETE.

import { graph } from "@graphrefly/ts/graph";
import { fromAsyncIter } from "@graphrefly/ts/sources";
const stream = graph().initNode(fromAsyncIter(events()), []);

packages/ts/src/graph/sources.ts