View Source Gitly.Utils.Archive.Extractor (gitly v0.1.0)

Provides functionality to extract various types of archives.

This module supports extracting ZIP, TAR, TAR.GZ, and TGZ archives.

Summary

Functions

Extracts an archive to the given destination.

Types

@type extract_result() :: {:ok, Path.t()} | {:error, String.t()}

Functions

@spec extract(Path.t(), Path.t()) :: extract_result()

Extracts an archive to the given destination.

Parameters

  • path - The path to the archive file.
  • dest - The destination directory where the archive should be extracted.

Returns

  • {:ok, dest} if the extraction was successful.
  • {:error, reason} if the extraction failed or the archive type is unsupported.

Examples

iex> Gitly.Utils.Archive.Extractor.extract("example.zip", "/tmp/extract")
{:ok, "/tmp/extract"}

iex> Gitly.Utils.Archive.Extractor.extract("example.rar", "/tmp/extract")
{:error, "Unsupported archive type"}