exfile v0.3.1 Exfile.LocalFile

Represents a file on the local filesystem.

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

Types

t :: %Exfile.LocalFile{io: :file.io_device, meta: map, path: String.t}

Functions

copy_to_tempfile(local_file)

Specs

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).

open(local_file)

Specs

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.

put_meta(file, key, value)

Specs

put_meta(t, atom, any) :: t
size(local_file)

Specs

size(t) :: {:ok, integer} | {:error, :file.posix}

Returns the size (in bytes) of the file.