MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/nodejs-docs-samples / createDiagram

Function createDiagram

run/system-package/app.js:47–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45// [START cloudrun_system_package_exec]
46// Generate a diagram based on a graphviz DOT diagram description.
47const createDiagram = dot => {
48 if (!dot) {
49 throw new Error('syntax: no graphviz definition provided');
50 }
51
52 // Adds a watermark to the dot graphic.
53 const dotFlags = [
54 '-Glabel="Made on Cloud Run"',
55 '-Gfontsize=10',
56 '-Glabeljust=right',
57 '-Glabelloc=bottom',
58 '-Gfontcolor=gray',
59 ].join(' ');
60
61 const image = execSync(`/usr/bin/dot ${dotFlags} -Tpng`, {
62 input: dot,
63 });
64 return image;
65};
66// [END cloudrun_system_package_exec]
67
68module.exports = app;

Callers 1

app.jsFile · 0.85

Calls 1

execSyncFunction · 0.50

Tested by

no test coverage detected