A secure, command-line file sharing tool built with Node.js and TypeScript that enables encrypted file transfers between devices over a network.
- 🔐 End-to-End Encryption: Files are encrypted using AES-256-GCM with password-based key derivation
- 📊 Real-time Progress: Visual progress tracking for both sending and receiving
- 🛡️ Integrity Verification: Built-in authentication tags to ensure file integrity
- ⚡ Fast Transfer: Direct TCP socket communication for optimal performance
- 🔑 Password Protection: Secure transfers with minimum 6-character passwords
- 📱 Cross-Platform: Works on any system with Node.js
- Node.js (v14 or higher)
- TypeScript compiler
- Clone the repository:
git clone <repository-url>
cd node-share- Install dependencies:
npm install- Build the project:
npx tscThe application has two modes: send and receive.
On the receiving device, start the server:
node build/index.js --receive <sender-ip> <password>Example:
node build/index.js --receive 192.168.1.100 mypassword123The receiver will:
- Start a server on port 3001
- Wait for incoming connections
- Display progress as files are received
On the sending device, transfer a file:
node build/index.js --send <receiver-ip> <file-path> <password>Example:
node build/index.js --send 192.168.1.200 ./documents/report.pdf mypassword123The sender will:
- Connect to the receiver on port 3001
- Encrypt and transfer the file
- Show transfer progress
- Connection: Sender connects to receiver via TCP on port 3001
- Key Exchange: Password is used with salt to derive encryption keys using scrypt
- Metadata: File information (name, size, salt, IV) is sent as header
- Encryption: File is encrypted using AES-256-GCM with random IV
- Transfer: Encrypted data is streamed with real-time progress
- Verification: Authentication tag ensures file integrity
- AES-256-GCM Encryption: Industry-standard authenticated encryption
- Key Derivation: Uses scrypt with random salts for key generation
- Authentication: Built-in integrity verification with auth tags
- Random IVs: Each transfer uses a unique initialization vector
- Both devices must be on the same network or have direct connectivity
- Port 3001 must be accessible on the receiving device
- Firewall may need to allow connections on port 3001
src/
├── index.ts # Main entry point and CLI argument parsing
├── send-file.ts # File sending logic with encryption
├── receive-file.ts # File receiving logic with decryption
├── progress.ts # Progress tracking utilities
└── constants.ts # Application constants
# On receiver (192.168.1.200)
node build/index.js --receive 192.168.1.100 secretpass
# On sender (192.168.1.100)
node build/index.js --send 192.168.1.200 ./photo.jpg secretpass# Transfer a large video file
node build/index.js --send 192.168.1.200 ./videos/movie.mp4 strongpassword123The application handles various error conditions:
- Wrong Password: File transfer fails with integrity verification error
- Network Issues: Connection errors are displayed with helpful messages
- File Not Found: Clear error message when source file doesn't exist
- Invalid Arguments: Validation for required parameters and password length
npx tsc- TypeScript source files in
src/ - Compiled JavaScript output in
build/ - Configured for CommonJS modules with ES2016 target
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is open source and available under the MIT License.