Treemaps in the terminal
$ npm install --save terminal-treemap
const terminalTreemap = require('terminal-treemap');
const data = [
{ content: 'Foo\n250kb', value: 50 },
{ content: 'Bar\n150kb', value: 25 },
{ content: 'Baz\n150kb', value: 5 },
{ content: 'Baz\n150kb', value: 5 },
];
const output = terminalTreemap(data);
console.log(output);
Input should be an array of objects where each object has a content
prop and a value
prop. The value property will be used to ratio the size of the boxes in the terminal.
Inspiration from boxen by Sindre.
MIT © Brian Hann