F3. IO. FileSystem. OS
(F3 v0.1.0)
Copy Markdown
F3.IO.FileSystem implementation that calls File and :file.
stat/1 uses File.stat/1. open/2, pread/3, and close/1 use the
Erlang :file module. Errors are the atoms those functions return.
They do not raise for a missing path.
Summary
Functions
:file.close/1 for an open descriptor.
:file.open/2 for path and modes.
:file.pread/3 for an open descriptor.
File.stat/1 for path.
Functions
:file.close/1 for an open descriptor.
Examples
iex> {:ok, fd} = F3.IO.FileSystem.OS.open("test/fixtures/small.f3", [:read, :binary])
iex> F3.IO.FileSystem.OS.close(fd)
:ok
:file.open/2 for path and modes.
Examples
iex> {:ok, fd} = F3.IO.FileSystem.OS.open("test/fixtures/small.f3", [:read, :binary])
iex> :ok = F3.IO.FileSystem.OS.close(fd)
iex> is_pid(fd) or is_reference(fd) or is_tuple(fd) or is_atom(fd)
true
:file.pread/3 for an open descriptor.
Examples
iex> {:ok, fd} = F3.IO.FileSystem.OS.open("test/fixtures/small.f3", [:read, :binary])
iex> {:ok, "F3"} = F3.IO.FileSystem.OS.pread(fd, 4166, 2)
iex> :ok = F3.IO.FileSystem.OS.close(fd)
:ok
File.stat/1 for path.
Examples
iex> {:ok, stat} = F3.IO.FileSystem.OS.stat("test/fixtures/small.f3")
iex> stat.size
4168
iex> F3.IO.FileSystem.OS.stat("missing-file.f3")
{:error, :enoent}