hierarchy
Convert JSON object to a beautiful string representation of a directory structure
Like archy, but easier. Inspired in the text-tree found in an answer on StackOverflow.
Installation
npm i --save hierarchyjs
Usage
Considering the input.json
file:
From the command line
hierarchy input.json
In code
var hierarchy = ;var input = ;var tree = ; console;
Notation
The input is expected to be a tree-like object with optional $files
arrays that describe a list of files in a directory. The $files
construct can actually be avoided by treating files as empty directories, but its a little convenience sugar.
The following has the exact same output as the previous example.
A file named $etc
might be used to include a "and more.." '....'
kind of message.
License
MIT