finds.dev← search

// the find

yangshun/tree-node-cli

★ 293 · TypeScript · MIT · updated Mar 2026

List directory contents in a tree-like format, similar to the Linux tree command

A TypeScript reimplementation of the Linux `tree` command for Node.js, usable both as a CLI (`npx tree-node-cli`) and as a library via `tree()` and `treeJson()`. Aimed at developers who want tree-style directory listings in cross-platform scripts or tooling without shelling out to the system binary.

Ships both a formatted-string API and a structured `treeJson()` API with a proper discriminated union type (`directory` vs `file`), so you can build your own renderer instead of parsing text. Gitignore-aware by default, which is the right default for anyone pointing this at a real JS project. Option surface is a near-complete match for real `tree` (sort modes, sizes with SI/human-readable/du variants, permissions, JSON output, pruning), and the test fixtures show real attention to edge cases: unicode filenames, emoji, empty dirs, permission-denied directories degrading to an inline error marker instead of throwing.

The npm package name collides with the built-in `tree` command on Windows and Linux, so users have to install and remember a different binary name (`treee`) — an awkward wart for a tool whose whole pitch is being a drop-in stand-in. At 293 stars it hasn't seen much adoption relative to how complete it is, likely because most people already have real `tree` on their PATH or reach for `ls`/`fd` piped through something. Symlinks are silently never followed with no option to opt in, which is a real limitation if you need to traverse linked workspaces. `treeJson()` builds the entire structure in memory in one pass, so there's no streaming path for very large trees (huge monorepos, `node_modules` with `--no-gitignore`).

View on GitHub → Homepage ↗

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →