toolshed v0.2.0 Toolshed.Misc

Miscellaneous helpers

Link to this section Summary

Functions

Load an Erlang term from the filesystem

Save an Erlang term to the filesystem for easy loading later

Save a value to a file as Elixir terms

Link to this section Functions

Link to this function load_term!(path)

Load an Erlang term from the filesystem.

Examples

#

iex> save_term!({:some_interesting_atom, ["some", "list"]}, "/root/some_atom.term")
{:some_interesting_atom, ["some", "list"]}
iex> load_term!("/root/some_atom.term")
{:some_interesting_atom, ["some", "list"]}
Link to this function save_term!(value, path)
save_term!(term(), Path.t()) :: term()

Save an Erlang term to the filesystem for easy loading later

This function is returns the value passed in to allow easy piping.

Examples

#

iex> :sys.get_state(MyServer) |> save_term!("/root/my_server.term")
# Reboot board
iex> :sys.replace_state(&load_term!("/root/my_server.term"))
Link to this function save_value(value, path, inspect_opts \\ [])

Save a value to a file as Elixir terms

Examples

# Save the contents of SystemRegistry to a file
iex> SystemRegistry.match(:_) |> save_value("/root/sr.txt")
:ok