bird-flowchart-generator

1.1.0 • Public • Published

bird-flowchart-generator

bird-flowchart-generator is a library that lets you transform this JSON:

[
    { name: "this package" },
    { bird: 1, name: "useful NPM packages" },
    { bird: 2, name: "JS community" },
    { bird: 3, name: "JS community" }
]

into this image: funny_meme

You can use it for example in Express endpoint:

const bird = require("bird-flowchart-generator")
const express = require('express')
const app = express()
app.get('/', (req, res) => {
	bird.generateBirdFlowchart([
	    { name: "this package" },
	    { bird: 1, name: "useful NPM packages" },
	    { bird: 2, name: "JS community" },
	    { bird: 3, name: "JS community" },
	], imgBuffor => {
	    res.writeHead(200, {
	    	'Content-Type': 'image/png',
	    	'Content-Length': imgBuffor.length
	    });
	    res.end(imgBuffor); 
	})	
});

or save your image to file:

const bird = require("bird-flowchart-generator")
const fs = require("fs")
bird.generateBirdFlowchart([
    { name: "Jquery" },
    { bird: 1, name: "Angular" },
    { bird: 2, name: "React" },
], buffer => {
    fs.writeFileSync("../birds.png", buffer)
})

btw. pls use Node 7+ because this lib uses quite a lot of async await.

Package Sidebar

Install

npm i bird-flowchart-generator

Weekly Downloads

0

Version

1.1.0

License

GPL-3.0

Last publish

Collaborators

  • cipuszhujan