Skip to content

v3.0.0

Latest

Choose a tag to compare

@yangshun yangshun released this 07 Mar 13:09

What's New

New Features

  • JSON output format (-J flag) — output directory tree as JSON
  • Gitignore support — respects .gitignore patterns by default
  • Full path prefix (-f flag) — display full path for each entry
  • Prune empty directories (--prune flag) — remove empty directories from output
  • File permissions (-p flag) — show file type and permissions
  • Last modification time (-D flag) — show last modification time for each entry
  • Quoted filenames (-Q flag) — quote filenames in double quotes
  • No-indentation mode (-i flag) — print entries without tree indentation lines
  • Disk usage (--du flag) — 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: -s for raw bytes, -h for human-readable (1024-based), --si for 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 lstatSync results 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