Crates.io | streaming-http-range-client |
lib.rs | streaming-http-range-client |
version | 0.1.1 |
source | src |
created_at | 2023-12-05 00:12:55.517295 |
updated_at | 2024-07-15 02:35:29.381427 |
description | A client for ergonomically streaming HTTP Range requests |
homepage | |
repository | |
max_upload_size | |
id | 1058218 |
size | 24,503 |
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.