open-index/open-npm huggingface dataset:
npm package: @kunalkhandekar.dev/word-counter-cli
Description: A simple CLI to count words in a text file
Author: Sahil Khandekar
Latest version: 1.1.0

# @kunalkhandekar.dev/word-counter-cli

A simple Node.js CLI tool to count words in a text file. Optionally, you can also count the frequency of a **specific word**.

## 📦 Installation

```bash
npm install -g @kunalkhandekar.dev/word-counter-cli
```

## 🚀 Usage

### Count all words in a file

```bash
word-counter-cli <file-path>
```

Example:

```bash
word-counter-cli ./sample.txt
```

### Count a specific word

```bash
word-counter-cli <file-path> <word>
```

Example:

```bash
word-counter-cli ./sample.txt hello
```

---

## 📄 Example Output

```bash
word-counter-cli sample.txt
```

```json
{
  "hello": 3,
  "world": 2,
  "example": 1
}
```

```bash
word-counter-cli sample.txt hello
```

```bash
hello = 3
```

---

## 🛠 Features

- ✅ Count all words in a text file
- ✅ Count a specific word by providing a second argument
- ✅ Cleans up special characters and handles line breaks
- ✅ Case-insensitive counting

---

## 🧑‍💻 Author

**Sahil Khandekar**    
📦 [NPM](https://www.npmjs.com/package/@kunalkhandekar.dev/word-counter-cli)

---