File.read

You're seeing just the function read, go back to File module for more information.

Specs

read(Path.t()) :: {:ok, binary()} | {:error, posix()}

Returns {:ok, binary}, where binary is a binary data object that contains the contents of path, or {:error, reason} if an error occurs.

Typical error reasons:

  • :enoent - the file does not exist
  • :eacces - missing permission for reading the file, or for searching one of the parent directories
  • :eisdir - the named file is a directory
  • :enotdir - a component of the file name is not a directory; on some platforms, :enoent is returned instead
  • :enomem - there is not enough memory for the contents of the file

You can use :file.format_error/1 to get a descriptive string of the error.