Function file_fetcher::open_bytes_str [] [src]

pub fn open_bytes_str(url: &str) -> Result<Vec<u8>>

Open a string url to get bytes

Arguments

  • 'url' - the url to open

Examples

To load a local file (here ./src/lib.rs)

use std::fs;

let path = fs::canonicalize("./src/lib.rs").unwrap();
let local_bytes = file_fetcher::open_bytes_str(&format!("file://{}", path.display())).unwrap();

To load a remote file

let remote_bytes = file_fetcher::open_bytes_str("https://gitlab.com/Artefaritaj/file-fetcher/raw/master/src/lib.rs").unwrap();