Function oneio::get_remote_reader
source ยท pub fn get_remote_reader(
path: &str,
header: HashMap<String, String>
) -> Result<Box<dyn Read + Send>, OneIoError>
Expand description
Get a reader for remote content with the capability to specify headers.
Example usage:
use std::collections::HashMap;
let mut reader = oneio::get_remote_reader(
"https://SOME_REMOTE_RESOURCE_PROTECTED_BY_ACCESS_TOKEN",
HashMap::from([("X-Custom-Auth-Key".to_string(), "TOKEN".to_string())])
).unwrap();
let mut text = "".to_string();
reader.read_to_string(&mut text).unwrap();
println!("{}", text);