exfile v0.3.6 Exfile.LocalFile View Source

Represents a file on the local filesystem.

Link to this section Summary

Functions

Copies the LocalFile to a new file-based LocalFile

Opens a LocalFile into an IO pid

Returns the size (in bytes) of the file

Link to this section Types

Link to this type t() View Source
t() :: %Exfile.LocalFile{io: :file.io_device, meta: map, path: String.t}

Link to this section Functions

Link to this function copy_to_tempfile(local_file) View Source
copy_to_tempfile(t) :: t | no_return

Copies the LocalFile to a new file-based LocalFile.

Once the calling pid dies, the file will be automatically removed from the filesystem (see Exfile.Tempfile for more details).

Link to this function open(local_file) View Source
open(t) ::
  {:ok, :file.io_device} |
  {:error, :file.posix} |
  no_return

Opens a LocalFile into an IO pid.

If the LocalFile is already IO-based, the IO will be rewound to the beginning of the file.

Link to this function put_meta(file, key, value) View Source
put_meta(t, atom, any) :: t
Link to this function size(local_file) View Source
size(t) :: {:ok, integer} | {:error, :file.posix}

Returns the size (in bytes) of the file.