curl 'https://api.tor.hk/v1/random'<img src="https://api.tor.hk/v1/random" />fetch('https://api.tor.hk/v1/random')
.then(res => res.blob())
.then(blob => {
const img = document.createElement('img')
img.src = URL.createObjectURL(blob)
document.body.appendChild(img)
})use reqwest;
#[tokio::main]
async fn main() -> Result<()> {
let resp = reqwest::get("https://api.tor.hk/v1/random")
.await?;
let bytes = resp.bytes().await?;
println!("Downloaded " + &bytes.len().to_string() + " bytes");
Ok(())
}