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 🙏

© 2026 – Pkg Stats / Ryan Hefner

folder-tree-print

v1.0.0

Published

Print a beautiful tree view of any folder structure. Great for LLM context, docs, and sharing project layouts.

Readme

folder-tree-print

A zero-dependency CLI tool that prints your folder structure as a beautiful, colorized tree. Great for LLM context, README docs, and sharing project layouts.

What it does

Running folder-tree-print in any directory prints a tree view of its contents:

my-project/
├── src/
│   ├── components/
│   │   ├── Header.tsx
│   │   └── Footer.tsx
│   ├── utils/
│   │   └── helpers.ts
│   └── index.ts
├── package.json
├── tsconfig.json
└── README.md

3 directories, 6 files

It automatically colorizes output (directories in blue, symlinks in cyan, executables in green), sorts directories before files, and skips common noise like node_modules and .git.

Install

npm install -g folder-tree-print

Or run directly with npx:

npx folder-tree-print

Usage

# Current directory
folder-tree

# Specific folder
folder-tree-print ./src

# Limit depth
folder-tree-print -L 3

# Include hidden files, ignore specific folders
folder-tree-print -a -I logs -I tmp

# Directories only
folder-tree-print --dirs-only

# JSON output (great for piping)
folder-tree-print --json > structure.json

# Flat list
folder-tree-print --flat

# ASCII mode for legacy terminals
folder-tree-print --ascii

# Combine flags
folder-tree-print ./src -L 2 -d --no-color

Configuration

The script includes a CONFIG object at the top of the file that you can edit before running. Here's the full reference:

Display Format

| Option | Default | Description | | --------------- | ---------- | -------------------------------------------------------------------------------- | | displayFormat | "tree" | "tree" for box-drawing tree, "flat" for flat paths, "json" for JSON output | | treeStyle | "unicode"| "unicode" for ├── └──, "ascii" for +-- \--` (legacy terminal fallback) |

Sorting

| Option | Default | Description | | ----------- | -------------- | -------------------------------------------------------------------------------- | | sortOrder | "dirs-first" | "dirs-first" groups dirs above files, "alpha" pure alphabetical, "none" filesystem order |

Filtering

| Option | Default | Description | | ------------------- | ------- | ---------------------------------------------------------------- | | showHidden | false | Show hidden files and directories (dotfiles) | | dirsOnly | false | Show only directories, hide all files | | maxDepth | 0 | Maximum depth to traverse (0 = no limit) | | extraSkipDirs | [] | Additional directories to skip (merged with built-in list) | | extraSkipFiles | [] | Additional files to skip (merged with built-in list) | | onlyExtensions | [] | Only show files matching these extensions (empty = all) | | excludeExtensions | [] | Hide files matching these extensions |

Colors

| Option | Default | Description | | ---------- | ------- | -------------------------------------------------------------------- | | colorize | true | Enable colored output (blue dirs, cyan symlinks, green executables) |

Output

| Option | Default | Description | | ------------- | ------- | ---------------------------------------------------- | | showSummary | true | Show summary line at the end ("X directories, Y files") |

Example Configurations

Only show TypeScript and JavaScript files:

onlyExtensions: ["ts", "tsx", "js", "jsx"],

Use ASCII tree characters for CI logs:

treeStyle: "ascii",
colorize: false,

Shallow overview with no files:

dirsOnly: true,
maxDepth: 2,

CLI Options

| Flag | Short | Description | | -------------- | ----- | -------------------------------------------- | | --help | -h | Show help message | | --all | -a | Include hidden files (dotfiles) | | --dirs-only | -d | Show only directories | | --depth <n> | -L | Limit tree depth | | --ignore <s> | -I | Ignore matching names (repeatable) | | --no-color | | Disable colored output | | --no-summary | | Hide the summary line | | --flat | | Flat list instead of tree | | --json | | Output as JSON | | --ascii | | Use ASCII characters instead of Unicode |

Behavior

  • Color-coded — directories (blue), symlinks (cyan with → target), executables (green).
  • Smart defaults — auto-skips node_modules, .git, .next, dist, build, vendor, __pycache__, .idea, .vscode, and more.
  • Sorted output — directories listed before files, alphabetical within each group.
  • Symlink-aware — displays symlink targets with arrows.
  • Plural-correct summary — "1 directory, 1 file" vs "3 directories, 12 files".
  • Configurable — edit the CONFIG object for persistent preferences, or use CLI flags for one-off runs.

License

MIT