Fetches a gzipped tarball from a URL, verifies its SHA-256, and extracts it into a directory.
Refusal behaviour:
- A wrong checksum returns
{:error, {:checksum_mismatch, …}}beforedest_diris created. - A non-200 HTTP response returns
{:error, {:download_failed, status}}beforedest_diris created. - A path-traversal (
../) tar entry causes:erl_tarto refuse the archive before writing any entry; nothing escapesdest_dir. An emptydest_dirmay be created as a side-effect, but no content is extracted.
Summary
Functions
Download url, verify its SHA-256 equals sha256 (lowercase hex), and extract
the archive into dest_dir.
Functions
@spec install(String.t(), String.t(), Path.t()) :: :ok | {:error, {:download_failed, non_neg_integer()} | {:download_error, term()} | {:checksum_mismatch, String.t(), String.t()} | {:unsafe_tar_entry, String.t()} | {:extract_failed, term()}}
Download url, verify its SHA-256 equals sha256 (lowercase hex), and extract
the archive into dest_dir.