0.5.0 • Published 3 years ago
@diagrams-ts/graphviz-cli-renderer v0.5.0
GraphViz-CLI-Renderer
Thin nodejs wrapper for the dot
command 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 -v
Install this package by running:
npm install @diagrams-ts/graphviz-cli-renderer
# or when using yarn
yarn add @diagrams-ts/graphviz-cli-renderer
Usage
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);
}
})();