Security News
NVD Backlog Tops 20,000 CVEs Awaiting Analysis as NIST Prepares System Updates
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
node-plantuml
Advanced tools
A Node.js module and CLI for running PlantUML.
PlantUML is a popular diagramming tool that uses simple textual descriptions to draw UML diagrams. With the API provided by this module you can easily generate PlantUML diagrams directly from your Node.js application. It can also be used to encode and decode PlantUML source files.
This module also provides an easy to use and flexible command line interface for doing the same kind of operations as enabled by the API.
Install Graphviz to be able to generate all diagram types.
npm install node-plantuml
If you want to use the CLI node-plantuml can be install it globally:
npm install node-plantuml -g
Diagrams can be created from source files.
var plantuml = require('node-plantuml');
var fs = require('fs');
var gen = plantuml.generate("input-file");
gen.out.pipe(fs.createWriteStream("output-file.png");
If your application will be making multiple PlantUML requests, it might be a good idea to enable the usage of Nailgun.
Following is an example of a simple web server for generating images from encoded PlantUML source.
var express = require('express');
var plantuml = require('node-plantuml');
var app = express();
plantuml.useNailgun(); // Activate the usage of Nailgun
app.get('/png/:uml', function(req, res) {
res.set('Content-Type', 'image/png');
var decode = plantuml.decode(req.params.uml);
var gen = plantuml.generate({format: 'png'});
decode.out.pipe(gen.in);
gen.out.pipe(res);
});
app.get('/svg/:uml', function(req, res) {
res.set('Content-Type', 'image/svg+xml');
var decode = plantuml.decode(req.params.uml);
var gen = plantuml.generate({format: 'svg'});
decode.out.pipe(gen.in);
gen.out.pipe(res);
});
app.listen(8080);
The node-plantuml CLI can be accessed with the puml command.
puml generate file.puml -o file.png
It's also possible to use stdin and stdout for input and output.
puml decode UDfpLD2rKt0200GS0Iy0 | puml generate > file.png
Simple textual one-liners can also be used as input.
puml generate --unicode --text "A -> B: Hello"
┌─┐ ┌─┐
│A│ │B│
└┬┘ └┬┘
│ Hello │
│───────────>│
┌┴┐ ┌┴┐
│A│ │B│
└─┘ └─┘
There are multiple options for input and for output. And the output can be in multiple different formats.
Usage: puml [options] [command]
Commands:
generate [options] [file] Generate an UML diagram from PlantUML source
encode [options] [file] Encodes PlantUML source
decode <url> Decodes PlantUML source
testdot Test the installation of Graphviz dot
Options:
-h, --help output usage information
-V, --version output the version number
Usage: generate [options] [file]
Generate an UML diagram from PlantUML source
Options:
-h, --help output usage information
-p, --png ouput an UML diagram as a PNG image
-s, --svg ouput an UML diagram as an SVG image
-e, --eps ouput an UML diagram as an EPS image
-u, --unicode ouput an UML diagram in unicode text
-a, --ascii ouput an UML diagram in ASCII text
-o --output [file] the file in which to save the diagram
-c, --config [file] config file read before the diagram
-t, --text [text] UML text to generate from
-d, --dot [file] specify Graphviz dot executable
-i, --include [path] specify the path to include from
-C, --charset [charset] specify the charset of PlantUML source
Usage: encode [options] [file]
Encodes PlantUML source
Options:
-h, --help output usage information
-t, --text [text] UML text to encode
Usage: decode [options] <url>
Decodes PlantUML source
Options:
-h, --help output usage information
With predefined configuration templates the looks of the diagrams can be altered. For a more classic black and white look the classic configuration template can be used.
Compared to the standard PlantUML look:
MIT
FAQs
A Node.js module and CLI for running PlantUML
The npm package node-plantuml receives a total of 8,097 weekly downloads. As such, node-plantuml popularity was classified as popular.
We found that node-plantuml demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.