Crate manic

Source
Expand description

Fast and simple async_client downloads

Provides easy to use functions to download a file using multiple async_client connections while taking care to preserve integrity of the file and check it against a SHA256 sum

This crate is a work in progress

The crate exposes debug logs through the tracing crate

§Feature flags

  • progress: Enables progress reporting using indicatif
  • json: Enables use of JSON features on the reqwest Client
  • async: Enables the async downloader, on by default
  • threaded: Enables the native thread based downloader
  • rustls: Use rustls for HTTPS, on by default
  • openssl: Use openssl for HTTPS

§Crate usage

§Async example

use manic::Downloader;
#[tokio::main]
async fn main() -> Result<(), manic::ManicError> {
    let number_of_concurrent_tasks: u8 = 5;
    let client = Downloader::new("https://crates.io", number_of_concurrent_tasks).await?;
    let result = client.download().await?;
    Ok(())
}

§Native threading example

use manic::threaded::Downloader;
let client = Downloader::new("https://crates.io", 5)?;
client.download()?;
Ok(())

Modules§

async_client
header
HTTP header types
threaded

Structs§

Client
An asynchronous Client to make Requests with.
Downloader
MultiDownloader
ProgressStyle
Controls the rendering style of progress bars
Url
A parsed URL record.

Enums§

Hash
Available checksum types
ManicError
Error definition for possible errors in this crate

Type Aliases§

Result