View Source MyspaceIPFS.Utils (Myspace IPFS v0.1.0)

Some common functions that are used throughout the library.

Link to this section Summary

Functions

Filter out any empty values from a list. Removes nil, {}, [], and "".

Wraps the data in an elixir standard response tuple. {:ok, data} or {:error, data}

Removes a temporary file. To be used in a pipe, and hence returns the data sent to it.

Returns the current timestamp in unix time.

Returns the current timestamp in iso8601 format.

Unlists a list if it only contains one element.

Link to this section Types

Link to this section Functions

@spec filter_empties(list()) :: list()

Filter out any empty values from a list. Removes nil, {}, [], and "".

@spec okify(any()) :: {:ok, any()} | {:error, any()}

Wraps the data in an elixir standard response tuple. {:ok, data} or {:error, data}

Link to this function

remove_temp_file(data, file)

View Source

Removes a temporary file. To be used in a pipe, and hence returns the data sent to it.

@spec timestamp() :: integer()

Returns the current timestamp in unix time.

@spec timestamp(:iso) :: binary()

Returns the current timestamp in iso8601 format.

@spec unlist(list()) :: any()

Unlists a list if it only contains one element.