A Golang library for https://kroki.io/.
Create a client:
client := kroki.New(kroki.Configuration{
URL: "https://demo.kroki.io",
Timeout: time.Second * 20,
})
Use the FromString
function to convert a string to a diagram:
result, err := client.FromString("digraph G {Hello->World}", kroki.Graphviz, kroki.Svg)
Here, result
contains the image returned by Kroki as a string.
Use the FromFile
function to convert a file to a diagram:
echo "digraph G {Hello->World}" > hello.dot
result, err := client.FromFile("./hello.dot", kroki.Graphviz, kroki.Svg)
use the WriteToFile
function to write a result to a file:
err = client.WriteToFile("./result.svg", result)