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

@tb.p/get-exts

v1.0.0

Published

A CLI tool to scan directories recursively and return a list of file extensions

Readme

get-exts

A command-line tool to scan directories recursively and return a list of file extensions found within them.

Installation

Global Installation

npm install -g get-exts

Using npx (Recommended)

npx get-exts [directories...] [options]

Usage

Basic Usage

# Scan current directory
get-exts

# Scan specific directories
get-exts /path/to/directory1 /path/to/directory2

# Scan multiple directories
get-exts src/ lib/ tests/

Options

  • -c, --count - Show count of files for each extension
  • -h, --hidden - Include hidden files and directories
  • -e, --exclude-dirs <dirs> - Comma-separated list of directories to exclude (default: node_modules,.git,.vscode,.idea)
  • -x, --exclude-exts <extensions> - Comma-separated list of extensions to exclude
  • -j, --json - Output results in JSON format
  • -s, --sort <method> - Sort method: count, name, or none (default: name)
  • -f, --formatted - Output in formatted display mode (default is plain comma-separated)
  • -V, --version - Show version number
  • --help - Show help information

Examples

# Basic scan of current directory
get-exts

# Scan with file counts
get-exts --count

# Include hidden files
get-exts --hidden

# Exclude specific directories
get-exts --exclude-dirs "node_modules,dist,build"

# Exclude specific extensions
get-exts --exclude-exts ".log,.tmp,.cache"

# Output as JSON
get-exts --json

# Formatted display mode
get-exts --formatted

# Formatted output with counts
get-exts --formatted --count

# Sort by count (most files first)
get-exts --count --sort count

# Scan multiple directories with custom options
get-exts src/ lib/ --count --exclude-dirs "node_modules,temp" --json

Features

  • Recursive Scanning: Automatically scans subdirectories
  • Smart Exclusions: Excludes common directories like node_modules, .git, etc.
  • Hidden File Support: Option to include or exclude hidden files
  • Extension Filtering: Exclude specific file extensions from results
  • Count Mode: Show how many files exist for each extension
  • Multiple Output Formats: Plain text or JSON output
  • Flexible Sorting: Sort by extension name or file count
  • Multiple Directory Support: Scan multiple directories at once

Output Examples

Default Output (comma-separated without dots)

js,json,md,txt

Formatted Output

File Extensions Found:
==============================
.js
.json
.md
.txt
==============================
Scanned 1 directory: .

Count Mode Output

File Extensions Found:
==============================
.js: 15
.json: 3
.md: 2
.txt: 1
==============================
Scanned 1 directory: .

JSON Output

{
  ".js": 15,
  ".json": 3,
  ".md": 2,
  ".txt": 1
}

Default Output with Counts

js:15,json:3,md:2,txt:1

Development

Local Development

# Clone the repository
git clone <repository-url>
cd get-exts

# Install dependencies
npm install

# Run locally
npm start

# Or run the CLI directly
node bin/cli.js

Publishing to npm

# Login to npm
npm login

# Publish the package
npm publish

License

MIT

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

Issues

If you encounter any issues or have feature requests, please open an issue on the GitHub repository.