Terrasol (Terrasol v1.0.2) View Source
Various utility functions to assist with some of the unique requirements for Earthstar documents.
Link to this section Summary
Functions
Decode the Base32 standard for Earthstar
Encode the Base32 standard for Earthstar
Convert a duration into a number of microseconds.
Link to this section Functions
Decode the Base32 standard for Earthstar
Examples
iex> Terrasol.bdecode("b6cp2jipqt6jks")
"🤡💩"
iex> Terrasol.bdecode("bmfrggzdfmy")
"abcdef"
iex> Terrasol.bdecode("mfrggzdfmy")
:error
Encode the Base32 standard for Earthstar
Examples
iex> Terrasol.bencode("🤡💩")
"b6cp2jipqt6jks"
iex> Terrasol.bencode("abcdef")
"bmfrggzdfmy"
Convert a duration into a number of microseconds.
Integer durations are taken as a number of seconds.
Keyword lists are interpreted for the implemented durations. Unimplemented items are treated as 0
:weeks, :days, :hours, :minutes :seconds, :milliseconds, :microseconds
Examples
iex> Terrasol.duration_us(600)
600000000
iex> Terrasol.duration_us(minutes: 10, microseconds: 321)
600000321
iex> Terrasol.duration_us("600s")
0