Function eflint_to_json::download::download_file

source ·
pub fn download_file(
    source: impl AsRef<str>,
    target: impl AsRef<Path>,
    security: DownloadSecurity<'_>,
    verbose: Option<Style>,
) -> Result<(), Error>
Expand description

Downloads some file from the interwebs to the given location.

Courtesy of the Brane project (https://github.com/epi-project/brane/blob/master/brane-shr/src/fs.rs#L1285C1-L1463C2).

§Arguments

  • source: The URL to download the file from.
  • target: The location to download the file to.
  • verification: Some method to verify the file is what we think it is. See the VerifyMethod-enum for more information.
  • verbose: If not None, will print to the output with accents given in the given Style (use a non-exciting Style to print without styles).

§Returns

Nothing, except that when it does you can assume a file exists at the given location.

§Errors

This function may error if we failed to download the file or write it (which may happen if the parent directory of local does not exist, among other things).