#http-request #range #streaming #requests #tokio #io

streaming-http-range-client

A client for ergonomically streaming HTTP Range requests

5 releases (2 stable)

1.0.1 Jul 18, 2024
1.0.0 Jul 15, 2024
0.2.0 Jul 15, 2024
0.1.1 Dec 5, 2023
0.1.0 Dec 5, 2023

#217 in HTTP client

Download history 171/week @ 2024-07-17 16/week @ 2024-07-24 6/week @ 2024-07-31 2/week @ 2024-08-07 4/week @ 2024-08-14 3/week @ 2024-08-21 7/week @ 2024-08-28 20/week @ 2024-09-11 13/week @ 2024-09-18 9/week @ 2024-09-25 15/week @ 2024-10-02

226 downloads per month
Used in geomedea

MIT/Apache

30KB
681 lines

streaming_http_range_client

A client for ergonomically streaming HTTP Range requests in Rust.

use streaming_http_range_client::HttpClient;
use tokio::io::AsyncReadExt;

use tokio;
let mut new_client = HttpClient::new("https://georust.org");
new_client.set_range(2..14).await.unwrap();

let mut output = String::new();
new_client.read_to_string(&mut output).await.unwrap();

// This `expected_text` may need to be updated someday if someone updates the site.
let expected_text = "DOCTYPE html";
assert_eq!(expected_text, output)

This crate was written primarily to serve the needs of https://github.com/michaelkirk/geomedea, but it might be more generally useful.

Dependencies

~6–20MB
~290K SLoC