npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

fast-archy

v1.0.0

Published

render nested hierarchies `npm ls` style with unicode pipes

Readme

fast-archy

npm bundle size npm NPM

Render nested hierarchies npm ls style with unicode pipes.

Rewrite of archy in TypeScript, making it faster.

Install

npm install fast-archy

Usage

import archy from "fast-archy";

const s = archy({
  label: "beep\none\ntwo",
  nodes: [
    "ity",
    {
      label: "boop",
      nodes: [
        {
          label: "o_O\nwheee",
          nodes: [
            {
              label: "oh",
              nodes: ["hello", "puny\nmeat"],
            },
            "creature",
          ],
        },
        "party\ntime!",
      ],
    },
  ],
});

console.log(s);

Output:

beep
│ one
│ two
├── ity
└─┬ boop
  ├─┬ o_O
  │ │ wheee
  │ ├─┬ oh
  │ │ ├── hello
  │ │ └── puny
  │ │     meat
  │ └── creature
  └── party
      time!

API

archy(obj, prefix?, opts?)

  • obj object|string - Tree object or string label.
    • obj.label string - Node label.
    • obj.nodes array - Array of child nodes (same structure as obj).
  • prefix string - Custom prefix for tree branches (default: "").
  • opts object - Options object.
    • opts.unicode boolean - Use Unicode characters (default: true). If false, uses ASCII characters.

Benchmarks

clk: ~4.03 GHz
cpu: 13th Gen Intel(R) Core(TM) i5-13400F
runtime: node 24.1.0 (x64-win32)

benchmark                   avg (min … max) p75 / p99    (min … top 1%)
------------------------------------------- -------------------------------
• archy - simple tree
------------------------------------------- -------------------------------
fast-archy                   184.88 ns/iter 185.82 ns  █▂
                    (174.24 ns … 327.10 ns) 249.10 ns ▃██▅▅▂▂▁▂▁▁▁▁▁▁▁▁▁▁▁▁
                  gc(  1.43 ms …   4.21 ms) 412.22  b (138.33  b…812.80  b)

archy                        739.96 ns/iter 739.09 ns  █
                      (714.04 ns … 1.26 µs) 914.82 ns ▆██▅▃▂▂▁▁▁▁▁▁▁▁▁▁▁▁▁▁
                  gc(  1.47 ms …   3.67 ms)   1.88 kb (  1.84 kb…  2.40 kb)

summary
  fast-archy
   4x faster than archy

• archy - medium tree
------------------------------------------- -------------------------------
fast-archy                     1.33 µs/iter   1.33 µs  ▆█
                        (1.30 µs … 1.62 µs)   1.52 µs ▃██▇▆▃▂▂▂▁▁▁▁▁▁▁▁▁▁▁▁
                  gc(  1.48 ms …   3.35 ms)   2.44 kb (  2.42 kb…  3.38 kb)

archy                          3.84 µs/iter   3.89 µs           ▄█
                        (3.52 µs … 4.39 µs)   4.09 µs ▂▁▁▁▂▄▂▂▄▂██▇▇█▂▂▁▂▁▂
                  gc(  1.76 ms …   2.89 ms)   8.47 kb (  7.81 kb…  8.49 kb)

summary
  fast-archy
   2.89x faster than archy

• archy - complex tree
------------------------------------------- -------------------------------
fast-archy                   744.95 µs/iter 749.10 µs  ▆▇█
                    (718.30 µs … 989.60 µs) 854.40 µs ▄████▆▄▃▄▂▂▂▁▂▁▁▁▁▁▁▁
                  gc(  1.46 ms …   2.12 ms)   1.39 mb (  1.13 mb…  2.09 mb)

archy                          1.42 ms/iter   1.42 ms  ▆█▅▃
                        (1.33 ms … 2.29 ms)   1.81 ms ▃████▃▂▃▁▂▂▁▁▁▁▁▁▁▁▁▁
                  gc(  1.53 ms …   2.47 ms)   3.20 mb (  2.85 mb…  4.34 mb)

summary
  fast-archy
   1.9x faster than archy

• archy - ascii mode
------------------------------------------- -------------------------------
fast-archy (ascii)           876.87 ns/iter 879.76 ns  ▄▅█▄
                      (851.05 ns … 1.28 µs) 950.17 ns ▂████▅▅▃▅▃▃▁▂▃▁▁▂▂▁▁▁
                  gc(  1.49 ms …   3.16 ms)   2.12 kb (  2.07 kb…  3.26 kb)

archy (ascii)                  2.98 µs/iter   3.00 µs              █▄█
                        (2.79 µs … 3.06 µs)   3.06 µs ▂▁▂▁▁▁▃▁▂▁▂▃█████▄▃▂▂
                  gc(  1.66 ms …   3.01 ms)   8.60 kb (  8.57 kb…  9.82 kb)

summary
  fast-archy (ascii)
   3.4x faster than archy (ascii)

License

MIT