Examples

List of example graphs:

helloWorld_SVG apply_SVG indexOf_SVG loadScriptJS_SVG sum_SVG

D3 hello world

An example of dflow using d3, just to write an hello world is in the examples/d3 folder.

TODO extract the graph from the index.html source and make it visible and editable.

RequireBin

An example of dflow in a browser context, testing DOM manipulation.

view on requirebin

Stream playground

Node.js Stream Playground first example is

var fs = require("fs");

// Read File
fs.createReadStream("input/people.json")
    // Write File
    .pipe(fs.createWriteStream("output/people.json"));

It is ported to script stream.js which evaluates graph stream.json using few custom functions.

Packaged graph

The main advantage of dflow design is that you do not need to write components or plugins to extend it. You can use one of the most powerful JavaScript features: functions. Write your functions or import them from other packages like JQuery or underscore and you are able to use them as tasks and connect them with pipes.

Also every dflow graph is a function itself, so why not packaging it and put it on npm!?

It is really easy: create your dflow graph and save it to a JSON file, index.json for instance; then launch npm init as usual and when prompted for the entry point write index.json.

Simple as that, see npm-package-minimal as an example.

For a more complete example, see npm-package-template.