reqwest-file

Crates.ioreqwest-file
lib.rsreqwest-file
version0.2.1
sourcesrc
created_at2022-03-05 19:37:52.544947
updated_at2022-06-10 20:45:36.72548
descriptionUse web resources like regular async files
homepagehttps://github.com/alvra/reqwest-file
repositoryhttps://github.com/alvra/reqwest-file
max_upload_size
id544204
size148,095
Alexander van Ratingen (alvra)

documentation

https://docs.rs/reqwest-file

README

Reqwest-File

Use web resources like regular async files.

Features

  • No unsafe code (#[forbid(unsafe_code)])
  • Tested; code coverage: 100%

Example

use reqwest_file::RequestFile;
use tokio::io::{AsyncReadExt, AsyncSeekExt};

let client = reqwest::Client::new();
let request = client.get("http://httpbin.org/base64/aGVsbG8gd29ybGQ=");
let mut file: RequestFile = RequestFile::new(request);

let mut buffer = [0; 5];
assert_eq!(file.read(&mut buffer).await.unwrap(), 5);
assert_eq!(&buffer, b"hello");

let mut buffer = [0; 5];
assert_eq!(file.seek(std::io::SeekFrom::Current(1)).await.unwrap(), 6);
assert_eq!(file.read(&mut buffer).await.unwrap(), 5);
assert_eq!(&buffer, b"world");

Documentation

Documentation

Commit count: 11

cargo fmt