12 stable releases

new 2.2.6 Nov 14, 2024
2.2.5 Jun 7, 2024
2.2.4 Sep 19, 2023
2.2.3 May 14, 2023
1.0.0 Mar 29, 2022

#73 in Concurrency

Download history 95/week @ 2024-07-30 166/week @ 2024-08-06 105/week @ 2024-08-13 132/week @ 2024-08-20 234/week @ 2024-08-27 119/week @ 2024-09-03 58/week @ 2024-09-10 93/week @ 2024-09-17 211/week @ 2024-09-24 99/week @ 2024-10-01 112/week @ 2024-10-08 91/week @ 2024-10-15 77/week @ 2024-10-22 146/week @ 2024-10-29 151/week @ 2024-11-05 192/week @ 2024-11-12

609 downloads per month
Used in 9 crates

MIT license

300KB
578 lines

Trauma

Crates.io Documentation ci

Tokio Rust Asynchronous Universal download MAnager

Description

Trauma is a library simplifying and prettifying HTTP(s) downloads. The downloads are executed asynchronously and progress bars are drawn on the screen to help monitoring the process.

screenshot

Features

  • Library only
  • HTTP(S) downloads
  • Support download via proxies
  • Download files via providing a list of URLs
    • Ability to rename downloaded files
  • Ability to configure the download manager
    • Download directory
    • Maximum simultaneous requests
    • Number of retries
    • Resume downloads (if supported by the remote server)
    • Custom HTTP Headers
  • Asynchronous w/ Tokio
  • Progress bar w/ indicatif
    • Display the individual progress
    • Display the total progress
  • Ability to customize the progress bars
    • Customize the format
    • Customize the progression style
    • Leave them on the screen or clear them upon completion
    • Hide any or both of them
    • Add pre-configured styles

Usage

Add this to your Cargo.toml:

[dependencies]
trauma = "2"

Quick start

use std::path::PathBuf;
use trauma::{download::Download, downloader::DownloaderBuilder, Error};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let reqwest_rs = "https://github.com/seanmonstar/reqwest/archive/refs/tags/v0.11.9.zip";
    let downloads = vec![Download::try_from(reqwest_rs).unwrap()];
    let downloader = DownloaderBuilder::new()
        .directory(PathBuf::from("output"))
        .build();
    downloader.download(&downloads).await;
    Ok(())
}

More examples can be found in the examples folder. They are well commented and will guide you through the different features of this library.

Why another download manager

Before starting this project, I spent some time searching the internet, trying not to reinvent the wheel. And I did find a bunch of interesting existing projects!

However they are almost all abandoned:

As a result, I decided to write trauma.

Dependencies

~14–25MB
~348K SLoC