Expand description
Wrapper that uses the Range
HTTP header to resume get requests.
📦 Crates.io │ 📑 GitHub │ 💬 Chat
It’s a thin wrapper around reqwest
. It’s a work in progress – wrapping functionality is copied across on an as-needed basis. Feel free to open a PR/issue if you need something.
§Example
use async_compression::futures::bufread::GzipDecoder;
use futures::{io::BufReader, AsyncBufReadExt, StreamExt, TryStreamExt};
use std::io;
let url = "http://commoncrawl.s3.amazonaws.com/crawl-data/CC-MAIN-2018-30/warc.paths.gz";
let body = reqwest_resume::get(url.parse().unwrap()).await.unwrap();
// Content-Encoding isn't set, so decode manually
let body = body
.bytes_stream()
.map_err(|e| io::Error::new(io::ErrorKind::Other, e));
let body = BufReader::new(body.into_async_read());
let mut body = GzipDecoder::new(body); // Content-Encoding isn't set, so decode manually
body.multiple_members(true);
let mut lines = BufReader::new(body).lines();
while let Some(line) = lines.next().await {
println!("{}", line.unwrap());
}
Structs§
- Client
- A
Client
to make Requests with. - Request
Builder - A builder to construct the properties of a Request.
- Response
- A Response to a submitted Request.
Traits§
- Client
Ext - Extension to
reqwest::Client
that provides a method to convert it
Functions§
- get
- Shortcut method to quickly make a GET request.