Req.Tar (req v0.6.0)

Copy Markdown View Source

Tar archive decoding.

Summary

Functions

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

Functions

decode(binary)

@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}.