F3. File
(F3 v0.1.0)
Copy Markdown
Open file handle.
The handle owns a F3.IO.Source. F3.open/2 does not check magic or
decode metadata. F3.close/1 releases the source. Closing a closed
handle succeeds and returns the same closed handle.
A memory handle keeps the source binary until close. An HTTP handle's
origin is the url without userinfo. Inspect prints the origin, the
source module, and the closed flag. It does not print bytes or request
headers.
source_module is the F3.IO.Source implementation. source_state is
that module's handle. origin is the path, :memory, or the display
URL. closed is false until F3.close/1.
Examples
iex> {:ok, file} = F3.open("test/fixtures/small.f3")
iex> inspect(file)
~s(#F3.File<origin: "test/fixtures/small.f3", source: F3.IO.Local, closed: false>)
iex> {:ok, closed} = F3.close(file)
iex> closed.closed
true
Summary
Types
@type origin() :: Path.t() | :memory
Path, :memory, or the HTTP url with userinfo removed.
@type t() :: %F3.File{ closed: boolean(), origin: origin(), source_module: module(), source_state: F3.IO.Source.state() }