Archive Installer

This module provides a single unified pipeline for downloading, extracting, cleaning up, and renaming versioned archive packages (e.g. JDK / JRE distributions, generic web tarballs). It replaces three separate code paths that previously performed similar work:

  • sources/web.rs — buffered .bytes() download
  • download/web_source.rs — streaming bytes_stream() download
  • (removed) sources/temurin.rs::install_temurin_version — JDK-specific cleanup + rename

The installer streams the response body chunk-by-chunk via reqwest::Response::bytes_stream, emitting SourceProgress::Downloading events as each chunk is received. After the archive is written to a temporary path it is extracted into dest_dir’s parent directory; any leftover jdk* / jre* directories from a previous failed install are removed before extraction; the resulting top-level extracted directory is renamed to the version directory if it does not already match.

Examples

use stackie::sources::archive_installer::install_archive;
use std::path::Path;

# async fn example() -> anyhow::Result<()> {
let install_dir = install_archive(
    "https://example.com/jdk-17.0.9_9.tar.gz",
    "17.0.9+9",
    Path::new("/home/user/.stackie/sources/java/17"),
    true,
    None,
)
.await?;
println!("Installed to {}", install_dir.display());
# Ok(())
# }