Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including archy with all npm packages installed. Try it out:

var archy = require("archy")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

archy v1.0.0

render nested hierarchies `npm ls` style with unicode pipes


Render nested hierarchies npm ls style with unicode pipes.

browser support

build status


var archy = require('archy');
var s = archy({
  label : 'beep',
  nodes : [
      label : 'boop',
      nodes : [
          label : 'o_O',
          nodes : [
              label : 'oh',
              nodes : [ 'hello', 'puny' ]


├── ity
└─┬ boop
  ├─┬ o_O
  │ ├─┬ oh
  │ │ ├── hello
  │ │ └── puny
  │ └── human
  └── party


var archy = require('archy')

archy(obj, prefix='', opts={})

Return a string representation of obj with unicode pipe characters like how npm ls looks.

obj should be a tree of nested objects with 'label' and 'nodes' fields. 'label' is a string of text to display at a node level and 'nodes' is an array of the descendents of the current node.

If a node is a string, that string will be used as the 'label' and an empty array of 'nodes' will be used.

prefix gets prepended to all the lines and is used by the algorithm to recursively update.

If 'label' has newlines they will be indented at the present indentation level with the current prefix.

To disable unicode results in favor of all-ansi output set opts.unicode to false.


With npm do:

npm install archy




RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free