Skip to content

Repository files navigation

Dflow

A minimal Dataflow programming engine

See:

Usage

Let's start with an "Hello World!".

Define a single DflowNode that outputs to the console and create a dflow instance that runs it.

import { Dflow, type DflowNode } from "dflow";

// Define a node.
const helloWorld: DflowNode = {
  kind: "hello",
  run: () => console.log("Hello, World!")
};

const nodeDefinitions = [helloWorld];

// Create a dflow instance.
const dflow = new Dflow(nodeDefinitions);

// Add a node to the graph.
dflow.node("hello");

// Run the dflow graph.
dflow.run();

Important

The recommended way to run a graph is with await, wrapped in a try/catch block.

try {
  await dflow.run();
} catch (error) {
  // Here `error` should be an instance of `AggregateError`.
}

More examples available in the documentation, see the "Usage" section.

License

MIT

About

A minimal Dataflow programming engine

Topics

Resources

Contributing

Stars

Watchers

Forks

Used by

Contributors

Languages