Code, WebAssembly and Script Nodes
When the built-in nodes are not enough, drop into code. The Code node runs JavaScript or Python, the WASM node runs WebAssembly modules, and the Script Runner and Script Eval nodes run terminal commands.
Code Node
The Code node runs your own code as one step of a flow. Pick the language in the node's Language field.
Code runs in a pool of web workers, so heavy work does not freeze the canvas.
Inputs and outputs
Whatever arrives on the node's In port is available as inputs.in. To send data downstream, return an object with an out key:
const nums = inputs.in ?? [];
const total = nums.reduce((a, b) => a + b, 0);
return { out: { total, average: total / nums.length } };
You can also assign the object to a variable named result instead of returning it. In Python, assign to result:
nums = inputs.get("in", [])
total = sum(nums)
result = {"out": {"total": total, "average": total / len(nums)}}
Python inputs arrive as plain dictionaries and lists, and the returned dictionary is converted back to JSON-like data.
JavaScript
- Your code runs inside an async function, so you can use
await. - Standard built-ins are available:
Math,JSON,Date,Map,Set,RegExp, typed arrays,Intl,crypto,TextEncoderandWebAssembly. fetchis available for network requests.console.log,console.warnandconsole.errorshow up in the Debug Panel and the terminal.toast(message),confetti(),prompt(message),confirm(message)andnavigator.clipboardtalk to the editor when you run in the browser.ctx(alsocontext,globalandglobalThis) is an object shared by every Code node during one run, handy for passing state between nodes.math.evaluate("2 * (3 + 4)")evaluates a math expression.- The DOM,
window,evalandFunctionare not available. Reaching for one throws a clear error.
Python
Python runs in your browser on Pyodide, a WebAssembly build of CPython. The first Python node in a session takes a moment to load the runtime; after that it is fast.
Packages
Fill the Dependencies field to use libraries. Enter one per line or separate them with commas.
- Python:
packageorpackage==version, installed from PyPI with micropip. For examplenumpyorpandas==2.2.3. Packages must be pure Python or have a Pyodide build. - JavaScript: an npm package name such as
lodash, or a full URL to a script. Packages are loaded from a CDN and expose their global (for example_for lodash).
Dependencies are fetched on first use and reused for the rest of the session.
Run input text as code
By default, text arriving on In is data. Turn on Run input text as code to execute it instead. Use it only with input you trust. Hosting a flow is blocked when this node can be reached from a webhook or a credential.
WASM Node
The WASM node runs a WebAssembly module and returns the result.
- Mode: plain WASM, a WASI program or a component.
- Source: a URL, a Base64 string or a path in the virtual filesystem.
- Export Name: the exported function to call,
runby default. - Max Memory Pages: the memory limit for the module.
Script Runner and Script Eval
These two nodes run terminal commands, not JavaScript. A script is a list of commands, one per line, with # for line comments and /* */ for block comments.
# tune the editor, then run the flow
theme set mint
run
- Script Runner reads a script file from the virtual filesystem (for example
/scripts/my-script.script). - Script Eval runs the script text you give it.
Both output the number of commands executed and the list of commands. In the terminal, script <path> runs the same kind of file.
Terminal
Press Alt+S to open the dropdown terminal. It is a shell over the virtual filesystem, with commands for files (ls, cd, cat, edit, mkdir, cp, mv, zip), flows (run, stop, host, load, flob) and version control (git). Plugins can add their own commands.
Git
Your flows, notes, custom nodes and plugin data each live in their own git repository, created automatically the first time you save there. This powers version history in the File Explorer. Other files in the virtual filesystem are not tracked. You can also drive git from the terminal:
git status
git add .
git commit -m "tune the alert threshold"
git log
git branch feature
git checkout feature
Pair it with the text FDL format and flows diff cleanly in version control.
Best Practices
- Keep each Code node focused on one job, and prefer built-in nodes (Math, String Transform, JSON Path) for common operations.
- Use
fetchin code for one-off calls, and the HTTP Fetch node when you want the request visible on the canvas. - Return an
outobject so downstream nodes get a predictable shape. - Pin Python packages with
package==versionfor repeatable runs. - Avoid infinite loops and very large payloads; worker time and memory are limited.
Debugging
- Use
console.logand Logger nodes to print intermediate values. - Open the Debug Panel (Alt+D) for error messages and stack traces.
- Set a breakpoint on the node and step through with F10.
Sandbox
JavaScript runs in a restricted scope inside a worker. It cannot touch the page, the DOM or the main thread, and it only sees the globals listed above. Treat Code nodes in flows you import from others with the same care as any script, and read them before you run them.