Node API
- SHEET
- D3
- REV
- flowfig 0.8.4
- SOURCE
- README.md
- DATE
- 2026-10-06
flowfig/svg needs no React and no browser.
import { readFileSync, writeFileSync } from 'node:fs';import { check, toSvg } from 'flowfig/svg';
const spec = JSON.parse(readFileSync('first.json', 'utf8'));for (const f of check(spec)) console.log(f.severity, f.rule, f.message);writeFileSync('first.svg', toSvg(spec));toSvg(spec, options)returns the SVG string. The options arespeed,padding(default 24) andtheme.check(spec, options)returns the findings. It also takeswidthandminText.render(spec, options)returns{ svg, scene }. The scene is the layout that the check reads. Its shape can change.
flowfig/verify is for Node only. It exports verify, verifyReport (the findings and the counts), links, owners and parseSource, the same checks
as flowfig verify.
toSvg does not put the spec in the SVG. Only the CLI adds the spec, which --spec reads back.