GraphReFlyTS

API Reference

fromAsyncIter()

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

Import

import { fromAsyncIter } from "@graphrefly/ts/sources";

Signature

function fromAsyncIter(
	iterable: AsyncIterable<T>,
	opts?: AsyncSourceOpts,
): Operator<never, T>

Parameters

ParameterTypeDescription
iterableAsyncIterable<T>Async iterable to pump into the graph.
optsAsyncSourceOptsOptional abort signal and async source options.

Returns

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

Example

import { graph } from "@graphrefly/ts/graph";
import { fromAsyncIter } from "@graphrefly/ts/sources";

const stream = graph().initNode(fromAsyncIter(events()), []);

Source

packages/ts/src/graph/sources.ts