Registry / devtools / plantuml-api

plantuml-api

JSON →
library0.0.1jsnpmunverified

A minimal JavaScript client for generating PlantUML diagram URLs via the PlantUML web service. Current version 0.0.1 provides a single function geturl() that compresses PlantUML source text and returns a URL pointing to an image (PNG, SVG, ASCII art) hosted on plantuml.com. The library has dependencies on johan/js-deflate and plantuml-encoder for encoding. It is a very early package with limited documentation and no TypeScript types, suitable for quick prototyping but not production-grade.

npm install plantuml-api
INSTALL
IMPORT
SIG · PLANTUML-API
P
plantuml-api
devtoolsjavascriptv0.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

geturl
✓ const { geturl } = require('plantuml-api');
✗ import { geturl } from 'plantuml-api';
Package exports only via CommonJS require() as of v0.0.1; no ESM support yet.

Shows how to require the geturl function, generate an SVG URL for a simple diagram, and generate a PNG URL with full PlantUML syntax.

const { geturl } = require('plantuml-api'); // Generate SVG URL for a simple sequence diagram const url = geturl('Bob->Alice : hello', 'svg'); console.log(url); // Output: http://www.plantuml.com/plantuml/svg/SyfFqhLppCbCJbMmKiX8pSd91m00 // Generate PNG URL const pngUrl = geturl('@startuml\nAlice->Bob: hi\n@enduml', 'png'); console.log(pngUrl);
Debug
Known issues
gotchaURL generation depends on johan/js-deflate and plantuml-encoder — these dependencies are not automatically installed unless specified in package.json.
fix
Manually install dependencies: npm install johan/js-deflate plantuml-encoder
affects: >=0.0.0
gotchaThe geturl() function only returns a URL string; it does not fetch or render the diagram. Users must handle HTTP requests themselves.
fix
Use fetch() or axios to retrieve the image after obtaining the URL.
affects: >=0.0.0
gotchaNo TypeScript type definitions shipped; using with TypeScript requires manual declaration or use of require() in a .ts file.
fix
Add a // @ts-ignore or create a .d.ts file: declare module 'plantuml-api';
affects: >=0.0.0
Errors
Common errors & fixes
Cannot find module 'johan/js-deflate'
Missing npm dependency johan/js-deflate
fix
npm install johan/js-deflate
TypeError: geturl is not a function
Incorrect import pattern; using ESM import instead of CommonJS require
fix
Use const { geturl } = require('plantuml-api'); instead of import { geturl } from 'plantuml-api';
Upgrade
Version history
0.0.1latest on npm
Audit
Dependencies
johan/js-deflaterequiredRequired for deflate compression of PlantUML source
plantuml-encoderrequiredRequired for encoding the compressed data into a URL-safe format
Agent activity
24 hits · last 30 days
node
20
Resources
plantuml-api — npm install plantuml-api · libregistry