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

file-tree-cli

v0.0.2

Published

A powerful and flexible command-line tool for visualizing directory structures with advanced features and customization options.

Downloads

19

Readme

Features

  • 🎨 Colorized output (directories in blue, files in cyan)
  • 📏 Configurable directory traversal depth
  • 🔍 Multiple filtering options:
    • File extensions
    • Regular expression patterns
    • Hidden files
    • Directories/files only
  • 📊 File size display
  • 📅 Last modified dates
  • 🔄 Multiple sorting options
  • 💾 Save output to file
  • ⚡ Performance optimized

Usage

You can run the CLI tool directly using npx without installation:

npx file-tree-cli [options] [directory]

If you prefer to install it globally (optional):

npm install -g file-tree-cli
file-tree [options] [directory]

If no directory is specified, the current directory will be used.

Basic Examples

# Display tree of current directory
npx file-tree-cli

# Display tree of specific directory
npx file-tree-cli /path/to/directory

# Show tree with file sizes
npx file-tree-cli -s

# Show only JavaScript and TypeScript files
npx file-tree-cli --ext js,ts

# Show files modified dates and sizes
npx file-tree-cli -s -m

Advanced Examples

# Show only directories, sorted by name
npx file-tree-cli --dirs-only --sort name

# Show only JavaScript files and their sizes
npx file-tree-cli --ext js -s

# Show tree with custom depth and excluded directories
npx file-tree-cli -d 3 -e "dist,coverage"

# Show all files (including hidden) sorted by size
npx file-tree-cli -a --sort size

# Export tree to a file
npx file-tree-cli -o output.txt

Options

| Option | Description | Default | | -------------------------- | ---------------------------------------------- | ------- | | -d, --max-depth <number> | Maximum depth to traverse | ∞ | | -a, --all | Show hidden files | false | | -e, --exclude <items> | Comma-separated list of directories to exclude | [] | | -s, --show-size | Show file sizes | false | | -m, --modified | Show last modified date | false | | -f, --pattern <pattern> | Filter items by regex pattern | null | | --ext <extensions> | Filter by file extensions (comma-separated) | [] | | --sort <type> | Sort items by: name, size, or date | name | | -r, --reverse | Reverse sort order | false | | --dirs-only | Show only directories | false | | --files-only | Show only files | false | | -o, --output <file> | Save output to file | null |

Output Format

The tool provides a structured view of your directory:

Directory
├── src
│   ├── index.ts [2.5KB] 2024-01-15
│   └── utils.ts [1.2KB] 2024-01-14
└── package.json [0.8KB] 2024-01-10

Development

  1. Clone the repository:
git clone https://github.com/devxprite/file-tree-cli.git
  1. Install dependencies:
cd file-tree-cli
npm install
  1. Build the project:
npm run build
  1. Test locally:
# Run directly from the project directory
npm start

# Or use npm link for global testing
npm link
tree [options] [directory]

Contributing

Contributions are welcome! Here's how you can contribute:

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.