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

diffox

v1.0.1

Published

A lightweight, dependency-free Node.js CLI tool for comparing and synchronizing directories and files

Readme

diffox

A lightweight, dependency-free Node.js CLI tool for comparing and synchronizing directories and files. Features include recursive directory scanning, file content comparison using MD5 hashing, line-by-line file diffing, and intelligent synchronization based on modification timestamps.

✨ Features

  • Directory Comparison: Compare two directories recursively and identify differences
  • File Comparison: Compare individual files with line-by-line diffing
  • Smart Synchronization: Sync directories with timestamp-based conflict resolution
  • Zero Dependencies: Uses only Node.js built-in modules
  • Colored Output: Beautiful CLI output with color-coded results
  • File Export: Save comparison results to text files
  • Backup Support: Automatic backup creation before file modifications

🚀 Installation

npm install -g diffox

Or use directly without installation:

npx diffox

📖 Usage

Compare Directories

# Basic directory comparison
diffox compare ./folder1 ./folder2

# Compare and synchronize
diffox compare ./folder1 ./folder2 --sync

Compare Files

# Compare two files
diffox file-diff file1.txt file2.txt

# Save results to file
diffox file-diff file1.txt file2.txt -o differences.txt

Synchronize Directories

# Synchronize source to target
diffox sync ./source ./target

📋 Commands

| Command | Description | Example | |---------|-------------|---------| | compare | Compare two directories | diffox compare ./dir1 ./dir2 | | file-diff | Compare two files | diffox file-diff a.js b.js | | sync | Synchronize directories | diffox sync ./src ./backup |

⚙️ Options

| Option | Description | Example | |--------|-------------|---------| | -s, --sync | Synchronize after comparison | diffox compare ./a ./b --sync | | -o, --output | Save results to file | diffox file-diff a.js b.js -o diff.txt | | -v, --verbose | Verbose output | diffox compare ./a ./b --verbose | | -f, --force | Force operation without confirmation | diffox sync ./a ./b --force |

📊 Output Examples

Directory Comparison

🔍 Directory comparison started...

📊 COMPARISON RESULTS

✅ Matching files (3):
   file1.txt
   file2.txt
   subdir/file3.txt

❌ Missing files (2):
   file4.txt
   file5.txt

➕ Extra files (1):
   backup.txt

🔄 Changed files (1):
   config.json

📈 SUMMARY:
   Total files: 7
   Matching: 3
   Missing: 2
   Extra: 1
   Changed: 1

File Comparison

🔍 File comparison started...

❌ Files are different!
Reason: Content differs

📝 Differences (2 lines):
────────────────────────────────────────────────────────────────────────────────
Line 3:
  - file1.js: const version = "1.0.0";
  + file2.js: const version = "2.0.0";
────────────────────────────────────────────────────────────────────────────────
Line 5:
  - file1.js: console.log("Hello World");
  + file2.js: console.log("Hello Universe");
────────────────────────────────────────────────────────────────────────────────

📊 Summary:
   file1.js: 6 lines
   file2.js: 6 lines
   Different lines: 2

🔧 How It Works

Comparison Algorithm

  1. Recursive Scanning: Scans directories recursively, ignoring common system files
  2. Hash Comparison: Uses MD5 hashing for efficient content comparison
  3. Timestamp Analysis: Compares modification times for change detection
  4. Line-by-line Diffing: For files, shows exact line differences

Synchronization Strategy

  1. Missing Files: Copies files that exist in source but not in target
  2. Changed Files: Updates files based on modification timestamps
  3. Backup Creation: Creates .backup files before modifications
  4. Conflict Resolution: Prefers newer files based on timestamps

🛠️ Development

Prerequisites

  • Node.js 16+ (for ES modules support)

Local Development

# Clone the repository
git clone https://github.com/erencanucarr/diffox.git
cd diffox

# Run directly
node src/index.js compare ./test1 ./test2

Project Structure

diffox/
├── src/
│   ├── index.js          # Main CLI entry point
│   ├── utils.js          # Utility functions
│   ├── comparator.js     # Directory/file comparison logic
│   └── synchronizer.js   # Synchronization logic
├── package.json
└── README.md

🤝 Contributing

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

📝 License

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

🙏 Acknowledgments

  • Built with Node.js built-in modules only
  • Inspired by Unix diff and rsync tools
  • Designed for simplicity and reliability

Made with ❤️ for developers who love clean, dependency-free tools.