0.5.0 • Published 4 years ago
@diagrams-ts/graphviz-cli-renderer v0.5.0
GraphViz-CLI-Renderer
Thin nodejs wrapper for the dotcommand line interface installed with the graphviz package. Renders a string containing valid dot syntax to an image output.
Installation and Requirements
In order to create svg, png or webp output you'll need to install graphviz. This package expects dot cli of graphviz to be available in your path.
You can check this by running:
dot -vInstall this package by running:
npm install @diagrams-ts/graphviz-cli-renderer
# or when using yarn
yarn add @diagrams-ts/graphviz-cli-rendererUsage
import { CliRenderer } from "@diagrams-ts/graphviz-cli-renderer";
const render = CliRenderer({ outputFile: "./example.png", format: "png" });
(async () => {
try {
await render(
`digraph G {
a1 -> b2;
a1 -> b3
}`
);
} catch (error) {
console.log(error);
}
})();