What's New
New Features
- JSON output format (
-Jflag) — output directory tree as JSON - Gitignore support — respects
.gitignorepatterns by default - Full path prefix (
-fflag) — display full path for each entry - Prune empty directories (
--pruneflag) — remove empty directories from output - File permissions (
-pflag) — show file type and permissions - Last modification time (
-Dflag) — show last modification time for each entry - Quoted filenames (
-Qflag) — quote filenames in double quotes - No-indentation mode (
-iflag) — print entries without tree indentation lines - Disk usage (
--duflag) — show directory sizes as cumulative disk usage - All Linux tree sorting options — including version/natural sort (
-v) treeJson()API — programmatic JSON tree output
Improvements
- File size options now match Linux tree:
-sfor raw bytes,-hfor human-readable (1024-based),--sifor SI units (1000-based) - Permission errors handled gracefully, matching Linux tree behavior
- Refactored to tree-first architecture: build tree then format
- CLI options reordered to match Linux tree categories
- Test coverage improved from 80% to 98%
- Performance: cached
lstatSyncresults to avoid redundant syscalls
Breaking Changes
- File size flag behavior changed to match Linux tree (
-s,-h,--si) - Gitignore filtering is now enabled by default
- Requires Node.js >= 22
Full Changelog: v2.0.0...v3.0.0