Function libherokubuildpack::download_file[][src]

pub fn download_file(
    uri: impl AsRef<str>,
    destination: impl AsRef<Path>
) -> Result<(), DownloadError>
Expand description

Downloads a file via HTTP(S) to a local path

Examples

use libherokubuildpack::download_file;
use libherokubuildpack::sha256;
use tempfile::tempdir;

let temp_dir = tempdir().unwrap();
let temp_file = temp_dir.path().join("result.bin");

download_file("https://example.com/", &temp_file).unwrap();
assert_eq!(sha256(&temp_file).unwrap(), "ea8fac7c65fb589b0d53560f5251f74f9e9b243478dcb6b3ea79b5e36449c8d9");