A Golang library for https://kroki.io/.
Create a client:
client := kroki.New(kroki.Configuration{
URL: "https://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)