1
Fork 0
mirror of https://github.com/redstrate/Auracite.git synced 2025-07-01 18:17:46 +00:00
auracite/src/downloader.rs

14 lines
400 B
Rust
Raw Normal View History

use reqwest::Url;
2024-09-29 17:45:53 -04:00
2024-10-31 19:56:08 -04:00
pub async fn download(url: &Url) -> Result<Vec<u8>, reqwest::Error> {
let client = reqwest::Client::builder()
.no_proxy() // This fixes localhost connections... for some reason (https://github.com/seanmonstar/reqwest/issues/913)
2024-10-31 19:56:08 -04:00
.build()?;
let body = client.get(url.to_string())
.send()
.await;
2024-09-29 17:45:53 -04:00
2024-10-31 19:56:08 -04:00
Ok(body?.bytes().await?.to_vec())
2024-09-29 17:45:53 -04:00
}