# `OpenrelikWorkerCommon.ArchiveUtils`
[🔗](https://github.com/hacktobeer/openrelik-worker-common-elixir/blob/v0.1.0/lib/openrelik_worker_common/archive_utils.ex#L15)

Helper functions for extracting archives (`openrelik_worker_common.archive_utils`).

# `extract_archive`

```elixir
@spec extract_archive(
  map(),
  String.t(),
  String.t(),
  list() | keyword(),
  String.t() | nil,
  boolean(),
  list()
) :: {String.t(), String.t()}
```

Unpacks an archive using `tar` (for `.tgz` and `.tar.gz`) or `7z` (for all other archive formats).

## Parameters
* `input_file` - Input file map containing `"path"` and `"display_name"`.
* `output_folder` - OpenRelik output folder path.
* `log_file` - Path to write command stdout/stderr logs.
* `opts` - Optional keyword list (or positional arguments via `extract_archive/4..7`):
  * `:file_filter` - List of file patterns to extract (default `[]`).
  * `:archive_password` - Password of the input archive (default `nil`).
  * `:ignore_prompts` - Whether to ignore prompts during extraction (default `true`).
  * `:file_exclusion_filter` - List of file patterns to exclude (default `[]`).
  * `:which_fn` - Optional `(String.t() -> String.t() | boolean() | nil)` override for `System.find_executable/1`.
  * `:cmd_runner` - Optional `(command_list, log_file -> integer())` override for command execution.
  * `:mkdir_fn` - Optional `(String.t() -> :ok)` override for directory creation.

## Returns
`{command_string, export_folder}` where `command_string` is the executed command string
and `export_folder` is the root folder path to the unpacked archive.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
