| Crates.io | parallel_downloader |
| lib.rs | parallel_downloader |
| version | 0.3.0 |
| created_at | 2025-12-06 06:50:44.033704+00 |
| updated_at | 2025-12-13 10:13:29.43822+00 |
| description | A robust, concurrent file downloader designed to be resilient, supporting automatic retries, crash recovery, and download verification. |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1969698 |
| size | 163,505 |
A robust, concurrent file downloader built in Rust. It is designed to be resilient, supporting automatic retries, crash recovery, and download verification.
.state.json). If the program crashes or is interrupted, simply run the command again to resume exactly where it left off.-i list.txt) for bulk downloads.Parallel Downloader uses a chunk-based parallel downloading approach:
*.state.json files for resumabilityThis approach maximizes bandwidth utilization while providing robust error recovery and resumability.
Download the latest release for Windows, Linux, or macOS from the Releases Page.
git clone https://github.com/velumuruganr/parallel_downloader.git
cd parallel_downloader
cargo install --path .
Note: The CLI binary is provided in src/bin/pd/main.rs (the CLI glue is in src/bin/pd/). When developing from source you can run the binary directly with:
# Run the library's CLI binary from source
cargo run --bin pd -- run --url "https://example.com/large.iso"
1. Standalone Mode (CLI)
Best for quick, one-off downloads.
# Simple download (defaults to 4 threads)
pd run --url "https://example.com/large.iso"
# Advanced Usage
pd run \
--url "https://example.com/movie.mp4" \
--output "holiday.mp4" \
--threads 8 \
--rate-limit 1048576 \
--dir ./downloads
2. Batch Mode
Download a list of URLs (one per line).
# Download files from list.txt, 3 files at a time
pd run -i list.txt -c 3
3. Daemon Mode (Background Service)
Best for long-running servers or managing queues.
# 1. Start the daemon in a separate terminal
pd start
# 2. Add downloads from any terminal
pd add --url "https://example.com/file1.zip"
pd add --url "https://example.com/file2.zip"
# 3. Check status
pd status
# 4. Control downloads
pd pause 1 # Pause download with ID 1
pd resume 1 # Resume download with ID 1
# 5. Interactive dashboard
pd tui # Open terminal user interface
# 6. Shutdown
pd stop
| Flag | Description | Default |
|---|---|---|
--url, -u |
The URL to download | Required |
--output, -o |
Output filename | output.bin |
--threads, -t |
Number of concurrent threads | 4 |
--rate-limit |
Max speed in bytes/sec (e.g., 1048576 = 1MB/s) | Unlimited |
--verify-sha256 |
Hash string to verify file integrity | None |
--dir, -d |
Directory to store downloads | Current Dir |
--input, -i |
Input file with list of URLs (one per line) | None |
--concurrent_files, -c |
Number of concurrent downloads in batch mode | 3 |
| Command | Description |
|---|---|
pd run |
Download a single file or batch of files |
pd start |
Start the background daemon |
pd add |
Add a download to the running daemon |
pd status |
List active downloads |
pd pause |
Pause a specific download by ID |
pd resume |
Resume a specific download by ID |
pd tui |
Open interactive terminal dashboard |
pd stop |
Stop the daemon |
This project supports reading settings from a config.toml file or from
environment variables prefixed with PD.
File locations (platform-specific):
~/.config/pd/config.toml~/Library/Application Support/pd/config.toml%APPDATA%\pd\config.tomlExample: copy config.example.toml to one of the locations above and edit
values such as threads, rate_limit, default_dir, concurrent_files,
server_secret, and server_addr.
Environment variables: you can override values via environment variables using
__ as a separator. For example:
# set threads to 8
export PD__threads=8
# set global rate limit to 1 MiB/s
export PD__rate_limit=1048576
# set server secret for daemon authentication
export PD__server_secret="my-secret-key"
# set server bind address
export PD__server_addr="0.0.0.0"
Environment variables take precedence over values found in config.toml.
You can use parallel_downloader as a library in your own project.
Add to your Cargo.toml:
[dependencies]
parallel_downloader = { version = "0.3.0", default-features = false }
Use the modules in your code:
use parallel_downloader::downloader::prepare_download;
use parallel_downloader::worker::download_chunk;
We use wiremock to simulate HTTP failures and chunk ranges without hitting real servers.
cargo test
The repository includes runnable examples in the examples/ folder to demonstrate how to use parallel_downloader programmatically in your own applications.
This example demonstrates a complete workflow: creating a client, verifying file size, and downloading chunks with a progress bar.
To run the example:
cargo run --example simple_download
You can view the full source code in examples/simple_download.rs.
Download fails with "Connection reset" errors
pd run --threads 2 --url <URL>State file corruption
.state.json file and restart the downloadDaemon connection refused
pd startHigh CPU usage
Permission denied errors
sudo if downloading to system directoriesWe welcome contributions! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
git clone https://github.com/velumuruganr/parallel_downloader.gitgit checkout -b feature/amazing-featurecargo testgit commit -m 'Add amazing feature'git push origin feature/amazing-featureThis project is licensed under the MIT License - see the LICENSE file for details.