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

dnms

v0.1.4

Published

A fast and efficient CLI tool to find and delete `node_modules` directories recursively, helping you reclaim valuable disk space from your development projects.

Readme

🗑️ Node Modules Cleaner

A fast and efficient CLI tool to find and delete node_modules directories recursively, helping you reclaim valuable disk space from your development projects.

Built with Bun for maximum performance.

✨ Features

  • 🚀 Blazing Fast: Leverages Bun's native APIs for optimal performance
  • 🔍 Recursive Scanning: Automatically finds all node_modules directories in a given path
  • 📊 Size Calculation: Shows how much disk space each directory occupies
  • 🛡️ Safe by Default: Multiple safety modes to prevent accidental deletions
  • 🎨 Beautiful CLI: Colorful, intuitive terminal interface
  • Efficient Deletion: Uses optimized methods for fast removal

📦 Installation

bun install

🚀 Usage

Run Without Install

With Bun:

bunx dnms --scan

With npm:

npx dnms --scan

Basic Commands

Scan directories without deleting:

bunx dnms --scan

Scan a specific directory:

bunx dnms --scan ~/projects

Dry run (see what would be deleted):

bunx dnms --dry-run

Delete with confirmation prompts:

bunx dnms --confirm

Verbose output:

bunx dnms --verbose --scan

Command-Line Options

| Option | Short | Description | |--------|-------|-------------| | --scan | -s | Scan only mode - finds node_modules without deleting | | --dry-run | -d | Shows what would be deleted without actually deleting | | --help | -h | Display help message with usage instructions | | --verbose | -v | Enable detailed output with progress indicators | | --confirm | -c | Ask for confirmation before each deletion |

Examples

Find all node_modules in your projects directory:

bunx dnms --scan ~/Documents/projects

Find all node_modules using the CLI name:

bunx dnms --scan ~/Documents/projects

Delete all node_modules with individual confirmation:

bunx dnms --confirm ~/Documents/projects

Preview deletion with detailed output:

bunx dnms --dry-run --verbose .

🔒 Safety Features

  1. Confirmation Prompt: By default, asks for confirmation before starting deletion
  2. Scan Mode: Preview what will be found before taking action
  3. Dry Run Mode: See exactly what would be deleted
  4. Per-Item Confirmation: Use --confirm to approve each deletion individually
  5. Graceful Ctrl+C: Cleanly exits on keyboard interrupt

📊 Output Example

╔══════════════════════════════════════════════════════════╗
║               🗑️  Node Modules Cleaner 🗑️                ║
║              Clean up disk space efficiently             ║
╚══════════════════════════════════════════════════════════╝

Mode: SCAN
Target: /Users/you/projects
Verbose: OFF

🔍 Searching for node_modules directories...

Found: /Users/you/projects/app1/node_modules (245.32 MB)
Found: /Users/you/projects/app2/node_modules (512.18 MB)
Found: /Users/you/projects/api/node_modules (189.45 MB)

============================================================
📊 SUMMARY
============================================================
Found: 3 node_modules directories
Total size: 946.95 MB

💡 Run without --scan to delete these directories

⏱️  Operation completed in 2.34s

🛠️ Technical Details

  • Built with TypeScript for type safety
  • Uses Bun's native APIs for file operations
  • Recursive directory traversal with readdir
  • Efficient size calculation using Bun.file() and Glob
  • Cross-platform compatibility

⚠️ Important Notes

  • This tool permanently deletes directories - use with caution
  • Always use --scan first to preview what will be found
  • You can always reinstall dependencies with bun install, npm install, etc.
  • The tool skips directories it cannot access

📝 License

This project was created using bun init in bun v1.3.5.

🤝 Contributing

Feel free to open issues or submit pull requests for improvements!