Skip to content

ParthPipermintwala/Word-Counter-CLI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Word Counter CLI banner Animated headline

Now available on npm! Install

Node.js NPM License Zero Dependencies


✨ Features

🎯 Smart Analysis - Count every word with precision
🔍 Word Search - Find specific word occurrences instantly
🎨 Case-Insensitive - Automatically handles uppercase/lowercase
🚀 Blazing Fast - Pure Node.js with zero dependencies
📋 Clean Output - Beautiful formatted results


📦 Installation

npm install -g @parth_pipermintwala/wordfreq

🚀 Quick Start

Count All Words

count ./text.txt

Output:

─────────────────────────────────────────────────────────────────
{ theory: 5, is: 4, in: 6, general: 1, any: 5, practice: 3 }
─────────────────────────────────────────────────────────────────
Total words: 250
─────────────────────────────────────────────────────────────────

Search for Specific Word

count ./text.txt theory

Output:

─────────────────────────────────────────────────────────────────
The word "theory" appears 5 times.
─────────────────────────────────────────────────────────────────

💡 Use Cases

📝 Content Writers - Analyze your writing patterns
🎓 Students - Study text composition and word usage
🔎 SEO Specialists - Check keyword density
📚 Researchers - Perform quick text analysis
✍️ Authors - Track word frequency in manuscripts


🛠️ How It Works

  1. 📖 Reads your text file
  2. 🔄 Converts to lowercase for consistency
  3. ✂️ Splits into individual words
  4. 🧹 Filters out numbers and punctuation
  5. 📊 Counts and displays results

⚙️ Technical Details

  • Runtime: Node.js 25.2.1+ (ESM modules)
  • Dependencies: Zero! Pure Node.js
  • File Support: Any text-based file format
  • Word Detection: Regex-based (/\W+/ split + alpha filter)
  • Error Handling: Clear messages for missing files or invalid paths

📖 Command Syntax

count <filePath> [wordToFind]
Argument Required Description
filePath ✅ Yes Path to the text file to analyze
wordToFind ⬜ Optional Specific word to search for

🎯 Pro Tips

💾 Export Results - Save counts to a file:

count document.txt > results.txt

🔗 Chain Commands - Combine with other tools:

cat *.txt | count combined.txt

📁 Analyze Multiple Files - Use a loop:

for file in *.txt; do count "$file"; done

📄 License

MIT © 2025


Made with ❤️ by Parth Pipermintwala

Report Bug · Request Feature

Releases

No releases published

Packages

No packages published