** Deprecated **

Overview

parallel-getter

When fetching a file from a web server via GET, it is possible to define a range of bytes to receive per request. This allows the possibility of using multiple GET requests on the same URL to increase the throughput of a transfer for that file. Once the parts have been fetched, they are concatenated into a single file.

Therefore, this crate will make it trivial to set up a parallel GET request, with an API that provides a configurable number of threads and an optional callback to monitor the progress of a transfer.

Features

  • Download a file with parallel GET requests to maximize bandwidth usage.
  • Specify mirrors to spread requests out to separate servers.
  • Control the number of threads to use to fetch a request.
  • Define a minimum threshold in size for storing parts in memory.
  • Define a minimum threshold for when threads should be used.
  • Specify a number of attempts to be made before giving up.
  • An optional callback for monitoring progress of a download.
  • Fall back to a single thread if the server does not support ranges.
  • Fall back to a single thread if the server does not return a content length.
  • Alternate between mirrors when retrying after a failure.

Example

extern crate reqwest;
extern crate parallel_getter;

use reqwest::Client;
use parallel_getter::ParallelGetter;
use std::fs::File;
use std::path::PathBuf;
use std::sync::Arc;

let client = Arc::new(Client::new());
let mut file = File::create("new_file").unwrap();
ParallelGetter::new("url_here", &mut file)
    // Additional mirrors that can be used.
    .mirrors(&["mirror_a", "mirror_b"])
    // Optional client to use for the request.
    .client(client)
    // Optional path to store the parts.
    .cache_path(PathBuf::from("/a/path/here"))
    // Number of theads to use.
    .threads(5)
    // threshold (length in bytes) to determine when multiple threads are required.
    .threshold_parallel(1 * 1024 * 1024)
    // threshold for defining when to store parts in memory or on disk.
    .threshold_memory(10 * 1024 * 1024)
    // Callback for monitoring progress.
    .callback(16, Box::new(|progress, total| {
        println!(
            "{} of {} KiB downloaded",
            progress / 1024,
            total / 1024
        );
    }))
    // Commit the parallel GET requests.
    .get();
You might also like...
Owner
Pop!_OS
An Operating System by System76
Pop!_OS
Webpack loader for Rust files. DEPRECATED, use WasmPack instead

The project is in low maintance now Use WasmPack instead Webpack Rust loader Webpack loader for Rust Example add.rs #[no_mangle] pub fn add(a: i32, b:

Max Eliseev 36 Jan 12, 2022
** Deprecated **

parallel-getter When fetching a file from a web server via GET, it is possible to define a range of bytes to receive per request. This allows the poss

Pop!_OS 69 Jun 19, 2021
Cardano Command Line Interface (CLI) (Deprecated)

Deprecated Note: This repository implements supports for Cardano Byron, and will not be updated to works on Cardano Shelley and further. cardano-cli T

Input Output 87 Oct 9, 2022
DEPRECATED. The Holochain framework implemented in rust with a redux style internal state-model.

Holochain-rust Travis: Circle CI: Codecov: License: This code is loosely based on the previous Golang prototype. Code Status: This Rust version is alp

Holochain 1k Jan 3, 2023
Fully typed SQL query builder for Rust [deprecated]

What is Deuterium? Deuterium is a fancy SQL builder for Rust. It's designed to provide a DSL to easily build SQL queries in safe and typed way. Like R

Stanislav Panferov 169 Nov 20, 2022