exfile v0.2.0 Exfile.Tempfile

A server (a GenServer specifically) that manages temporary files.

Temporary files are stored in a temporary directory and removed from that directory after the process that requested the file dies.

Summary

Functions

Requests a random file to be created in the temporary directory with the given prefix

Requests a random file to be created in the temporary directory with the given prefix. Raises on failure

Starts the temporary file handling server

Functions

random_file(prefix)

Specs

random_file(binary) ::
  {:ok, binary} |
  {:too_many_attempts, binary, pos_integer} |
  {:no_tmp, [binary]}

Requests a random file to be created in the temporary directory with the given prefix.

random_file!(prefix)

Specs

random_file!(binary) :: binary | no_return

Requests a random file to be created in the temporary directory with the given prefix. Raises on failure.

register_file(path)

Specs

register_file(binary) :: :ok
start_link()

Starts the temporary file handling server.