FastCopy is a high-performance, multi-threaded file copying utility built with Node.js and TypeScript. It's designed to efficiently copy large directories while providing real-time progress feedback.
- Multi-threaded Copying: Utilizes worker threads to parallelize the copying process, significantly improving performance on multi-core systems.
- Progress Tracking: Displays a real-time progress bar to visualize the copying process.
- Selective Copying: Intelligently skips certain directories (e.g.,
node_modules
,.git
) to focus on essential files. - Large File Optimization: Uses different copying strategies for large and small files to optimize performance.
- Windows Long Path Support: Automatically handles long file paths on Windows systems.
- Detailed Logging: Provides comprehensive error logging for troubleshooting.
- Node.js (version 18.0.0 or higher recommended)
- npm (comes with Node.js)
-
Clone this repository:
git clone https://github.com/yourusername/fastcopy.git cd fastcopy
-
Install dependencies:
npm install
-
Build the project:
npm run build
Run the FastCopy utility using the following command:
node dist/index.js --source="/path/to/source" --destination="/path/to/destination"
Replace /path/to/source
with the directory you want to copy from, and /path/to/destination
with the directory where you want to copy the files to.
You can customize the behavior of FastCopy by modifying the following constants in src/worker.ts
:
LARGE_FILE_THRESHOLD
: The size threshold (in bytes) for considering a file as "large". Default is 10MB.BATCH_SIZE
: The number of files processed in each batch by a worker thread. Default is 100.
To ignore additional directories, add them to the ignoredPaths
array in src/index.ts
.
- The main process scans the source directory and counts the total number of files to be copied.
- Files are divided into chunks and distributed among worker threads.
- Each worker thread processes its chunk of files, copying them to the destination.
- The main process displays overall progress and handles worker communication.
- Upon completion, a summary of the copying process is displayed.
- The number of worker threads is automatically set to the number of CPU cores available on the system.
- Large files are copied using
fs.copy
, while smaller files usefs.copyFile
for optimized performance. - The progress bar updates in real-time, providing accurate feedback on the copying process.
- Errors during the copying process are logged with detailed information.
- Skipped files are reported, allowing for easy identification of problematic files.
Contributions to FastCopy are welcome! Please feel free to submit a Pull Request. features in development:
- Encryption/Decryption: Secure file copying with encryption can be GPU-accelerated.
- Compression/Decompression: Compress files on-the-fly during copying.
- Checksum/Hashing: Generate checksums or hashes for files to ensure integrity.
This project is licensed under the MIT License - see the LICENSE file for details.