hex_tarball.unpack

You're seeing just the function unpack, go back to hex_tarball module for more information.

Specs

unpack(tarball(), :memory) ::
  {:ok,
   %{
     optional(:outer_checksum) => checksum(),
     optional(:inner_checksum) => checksum(),
     optional(:metadata) => metadata(),
     optional(:contents) => contents()
   }}
  | {:error, term()}
unpack(tarball(), filename()) ::
  {:ok,
   %{
     optional(:outer_checksum) => checksum(),
     optional(:inner_checksum) => checksum(),
     optional(:metadata) => metadata()
   }}
  | {:error, term()}
Link to this function

unpack(Tarball, Output, Config)

View Source

Specs

unpack(tarball(), :memory, :hex_core.config()) ::
  {:ok,
   %{
     optional(:outer_checksum) => checksum(),
     optional(:inner_checksum) => checksum(),
     optional(:metadata) => metadata(),
     optional(:contents) => contents()
   }}
  | {:error, term()}
unpack(tarball(), filename(), :hex_core.config()) ::
  {:ok,
   %{
     optional(:outer_checksum) => checksum(),
     optional(:inner_checksum) => checksum(),
     optional(:metadata) => metadata()
   }}
  | {:error, term()}

Unpacks a package tarball.

Remember to verify the outer tarball checksum against the registry checksum returned from hex_repo:get_package(Config, Package).

Examples:

  > hex_tarball:unpack(Tarball, memory).
  {ok,#{outer_checksum => <<...>>,
        contents => [{"src/foo.erl",<<"-module(foo).">>}],
        metadata => #{<<"name">> => <<"foo">>, ...}}}
 
  > hex_tarball:unpack(Tarball, "path/to/unpack").
  {ok,#{outer_checksum => <<...>>,
        metadata => #{<<"name">> => <<"foo">>, ...}}}