Skip to main content

download

Function download 

Source
pub async fn download(
    raw: &str,
    timeout: Duration,
    cap: u64,
    path: &Path,
) -> Result<u64, String>
Expand description

Stream one GET into a file, refusing anything over cap bytes.

This is the only request here that follows redirects, and the reason is narrow: a release asset URL on GitHub answers 302 to a signed CDN address by design, so refusing the hop would refuse every download. What vouches for the bytes is not the host that served them — it is the SHA256 the release published, checked after this returns.