View Source packbeam_api (atomvm_packbeam v0.7.2)

A library used to generate an AtomVM AVM file from a set of files (beam files, previously built AVM files, or even arbitrary data files).

Summary

Functions

Create an AVM file.

Delete selected elements of an AVM file.

Extract all or selected elements from an AVM file.

Return AVM element data.
Return AVM element module, if the element is a BEAM file.
Return the name of the element.
Indicates whether the AVM file element is a BEAM file.
Indicates whether the AVM file element is an entrypoint.

List the contents of an AVM file.

Types

-opaque avm_element()
-type avm_element_name() :: string().
-type options() ::
    #{prune => boolean(),
      start_module => module() | undefined,
      application_module => module() | undefined,
      include_lines => boolean()}.
-type path() :: string().

Functions

Link to this function

create(OutputPath, InputPaths)

View Source
-spec create(OutputPath :: path(), InputPaths :: [path()]) -> ok | {error, Reason :: term()}.

Create an AVM file.

Equivalent to create(OutputPath, InputPaths, DefaultOptions)

where DefaultOptions is #{ prune => false, start_module => undefined, application_module => undefined, include_lines => false }
Link to this function

create(OutputPath, InputPaths, Options)

View Source
-spec create(OutputPath :: path(), InputPaths :: [path()], Options :: options()) ->
          ok | {error, Reason :: term()}.

Create an AVM file.

This function will create an AVM file at the location specified in OutputPath, using the input files specified in InputPaths.
Link to this function

create(OutputPath, InputPaths, Prune, StartModule)

View Source
This function is deprecated. This function is deprecated. Use create/3 instead..
-spec create(OutputPath :: path(),
       InputPaths :: [path()],
       Prune :: boolean(),
       StartModule :: module() | undefined) ->
          ok | {error, Reason :: term()}.
Link to this function

create(OutputPath, InputPaths, ApplicationModule, Prune, StartModule)

View Source
This function is deprecated. This function is deprecated. Use create/3 instead..
-spec create(OutputPath :: path(),
       InputPaths :: [path()],
       ApplicationModule :: module() | undefined,
       Prune :: boolean(),
       StartModule :: module() | undefined) ->
          ok | {error, Reason :: term()}.
Link to this function

delete(OutputPath, InputPath, AVMElementNames)

View Source
-spec delete(OutputPath :: path(), InputPath :: path(), AVMElementNames :: [avm_element_name()]) ->
          ok | {error, Reason :: term()}.

Delete selected elements of an AVM file.

This function will delete elements of an AVM file at the location specified in InputPath, specified by the supplied list of names. The output AVM file is written to OutputPath, which may be the same as InputPath.
Link to this function

extract(InputPath, AVMElementNames, OutputDir)

View Source
-spec extract(InputPath :: path(), AVMElementNames :: [avm_element_name()], OutputDir :: path()) ->
           ok | {error, Reason :: term()}.

Extract all or selected elements from an AVM file.

This function will extract elements of an AVM file at the location specified in InputPath, specified by the supplied list of names. The elements from the input AVM file will be written into the specified output directory, creating any subdirectories if the AVM file elements contain path information.
Link to this function

get_element_data(AVMElement)

View Source
-spec get_element_data(AVMElement :: avm_element()) -> binary().
Return AVM element data.
Link to this function

get_element_module(AVMElement)

View Source
-spec get_element_module(AVMElement :: avm_element()) -> module() | undefined.
Return AVM element module, if the element is a BEAM file.
Link to this function

get_element_name(AVMElement)

View Source
-spec get_element_name(AVMElement :: avm_element()) -> avm_element_name().
Return the name of the element.
-spec is_beam(AVMElement :: avm_element()) -> boolean().
Indicates whether the AVM file element is a BEAM file.
Link to this function

is_entrypoint(AVMElement)

View Source
-spec is_entrypoint(AVMElement :: avm_element()) -> boolean().
Indicates whether the AVM file element is an entrypoint.
-spec list(InputPath :: path()) -> [avm_element()].

List the contents of an AVM file.

This function will list the contents of an AVM file at the location specified in InputPath.