Skip to content
Snippets Groups Projects
Unverified Commit 846c033c authored by Javier Viola's avatar Javier Viola Committed by GitHub
Browse files

Merge branch 'nik-provider-native' into refactor/nik-provider-native

parents d4c32382 8ebb3849
Branches
No related merge requests found
......@@ -9,4 +9,5 @@ edition = "2021"
thiserror = { workspace = true }
async-trait = { workspace = true }
futures = { workspace = true }
reqwest = "0.11.18"
pub mod fs;
pub mod net;
use std::io::Cursor;
type Result<T> = std::result::Result<T, Box<dyn std::error::Error + Send + Sync>>;
pub async fn download_file(url: String, dest: String) -> Result<()> {
let response = reqwest::get(url).await?;
let mut file = std::fs::File::create(dest)?;
let mut content = Cursor::new(response.bytes().await?);
std::io::copy(&mut content, &mut file)?;
Ok(())
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment