Redist.File (Hyper v0.1.0)

Copy Markdown View Source

Fetches a single raw file from a URL, verifies its SHA-256, and installs it at a destination path. The raw-file analogue of Redist.Targz (used for assets that ship as plain files rather than tarballs, e.g. vmlinux images).

Summary

Functions

Download url, verify its SHA-256 equals sha256 (lowercase hex), and install the file at dest_path (creating parent directories). The download lands in a temp dir first, so a failed verify never leaves a partial file at dest_path.

Functions

install(url, sha256, dest_path)

@spec install(String.t(), String.t(), Path.t()) ::
  :ok
  | {:error,
     {:download_failed, non_neg_integer()}
     | {:download_error, term()}
     | {:checksum_mismatch, String.t(), String.t()}
     | {:install_failed, term()}}

Download url, verify its SHA-256 equals sha256 (lowercase hex), and install the file at dest_path (creating parent directories). The download lands in a temp dir first, so a failed verify never leaves a partial file at dest_path.