Skip to content

alvra/reqwest-file

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Reqwest-File

Build status Crates.io Documentation unsafe forbidden

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

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

Use web resources like regular async files

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages