A command-line tool for monitoring file integrity, creating verified backups, and recovering corrupted files using cryptographic hashing.
File Sentinel helps you protect your data by:
- Detecting corruption - Verify files haven't been modified or damaged using SHA-256 hashes
- Creating backups - Replicate directories with automatic integrity verification
- Recovering files - Automatically restore corrupted files from backup copies (mirrors)
- Tracking changes - Maintain a database (digest) of file states over time
Install globally using npm:
npm install -g file-sentinelVerify installation:
file-sentinel --helpCreate a digest (inventory of your files):
file-sentinel digest -i ~/Documents::~/Documents/digest.dbVerify integrity:
file-sentinel verify -i ~/Documents::~/Documents/digest.dbCreate a backup:
file-sentinel replicate \
-i ~/Documents::~/Documents/digest.db \
-o /backup/Documents::/backup/Documents/digest.dbRecover corrupted files:
file-sentinel heal \
-i ~/Documents::~/Documents/digest.db \
--mirror /backup/Documents::/backup/Documents/digest.dbFile Sentinel provides four main commands:
- digest - Create or update a file inventory with cryptographic hashes
- verify - Check files against their recorded state to detect corruption
- replicate - Copy files to another location with integrity verification
- heal - Restore corrupted or missing files from backup mirrors
- SQLite-based digests - Fast, reliable database for storing file metadata
- SHA-256 hashing - Industry-standard cryptographic verification
- Mirror support - Multiple backup locations for redundancy
- Recycle bin - Soft deletion with recovery option
- Subdirectory filtering - Process only specific folders
- Progress reporting - Real-time feedback for long operations
- Cross-platform - Works on Linux, macOS, and Windows
- Dry-run mode - Preview changes before execution
Complete documentation is available in the docs/ directory:
- Getting Started Guide - Installation and first steps
- Core Concepts - Understanding digests, hashes, and mirrors
- Command Reference - Detailed command documentation
- Common Workflows - Real-world usage examples
- Troubleshooting - Solutions to common problems
- Node.js 18.0.0 or higher
- Operating System: Linux, macOS, or Windows
- Basic command-line familiarity
Clone and install dependencies:
git clone https://github.com/iShafayet/file-sentinel.git
cd file-sentinel
npm installCompile TypeScript to JavaScript:
npm run buildExecute the compiled version:
npm run start-compiledOr run directly with ts-node:
node dist/src/start.js <command> [options]Install the built version as a global command:
npm run install-cliRun the integration test suite:
npm testHere's a complete workflow for protecting important documents:
# 1. Create initial digest
file-sentinel digest -i ~/Documents::~/Documents/digest.db
# 2. Create a backup
file-sentinel replicate \
-i ~/Documents::~/Documents/digest.db \
-o /backup/Documents::/backup/Documents/digest.db
# 3. Verify integrity periodically
file-sentinel verify -i ~/Documents::~/Documents/digest.db
# 4. If corruption is detected, heal from backup
file-sentinel heal \
-i ~/Documents::~/Documents/digest.db \
--mirror /backup/Documents::/backup/Documents/digest.db
# 5. After making changes, update digest
file-sentinel digest -i ~/Documents::~/Documents/digest.db
# 6. Sync changes to backup
file-sentinel replicate \
-i ~/Documents::~/Documents/digest.db \
-o /backup/Documents::/backup/Documents/digest.dbFile Sentinel is useful for:
- Protecting important documents and files from corruption
- Creating and maintaining verified backups
- Detecting silent data corruption (bit rot)
- Archiving photos, videos, and media collections
- Maintaining data integrity for work files
- Synchronizing directories across multiple locations
- Recovering from hardware failures or accidental modifications
File Sentinel uses a special format to specify directories and their digest files:
/path/to/directory::/path/to/digest.db
The double colon (::) separates the directory from its digest file. This works on all platforms, including Windows:
C:\Users\YourName\Documents::C:\Users\YourName\digest.db
- npm Package: npmjs.com/package/file-sentinel
- GitHub Repository: github.com/iShafayet/file-sentinel
- Documentation: See the
docs/directory
For issues, questions, or contributions:
- Read the Troubleshooting Guide
- Check the Command Reference
- Open an issue on GitHub
File Sentinel is licensed under the GNU General Public License v3.0. See LICENSE for details.
2025 © Sayem Shafayet