# `Req.Tar`
[🔗](https://github.com/wojtekmach/req/blob/v0.8.0-rc.0/lib/req/tar.ex#L1)

Tar archive decoding using [`:erl_tar`].

`Req.Decode` can use this module for `.tar`, `.tgz`, `.tar.gz`, and `application/x-tar`
responses when the `:tar` or `:tgz` decoder is enabled via the `:decoders` option.

[`:erl_tar`]: `:erl_tar`

# `decode`

```elixir
@spec decode(binary()) ::
  {:ok, [{charlist(), binary()}]}
  | {:error,
     %Req.ArchiveError{
       __exception__: term(),
       data: term(),
       format: term(),
       reason: term()
     }}
```

Decodes a tar archive `binary` into a list of `{name, contents}` entries.

The binary may be a plain tar archive or a gzip-compressed one (`.tar.gz`/`.tgz`); the
compression is detected automatically.

Returns `{:ok, entries}` or `{:error, exception}`.

---

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