File

File :: # (opaque)

Open files for incremental, buffered reading.

Whole-file operations and filesystem metadata are available on Path. The host retains at most 64 readers. Opening another returns FileErr(Other("file reader capacity is exhausted")).

open_reader! : Path => Try(
    Reader,
    [
        FileErr(
            IOErr,
        ),
    ],
)

Open a file for buffered reading using the default buffer capacity.

reader = File.open_reader!("LICENSE")?
line = reader.read_line!()?

Reader

File.Reader :: # (opaque)

Represents a buffered file reader.

The file is automatically closed when the last reference to the reader is dropped. The host synchronizes its cursor, so it is safe to retain in application context. Concurrent reads saturate with FileErr(Other(...)).

to_inspect : Reader -> Str

Render the reader without exposing its host handle.

read_line! : Reader => Try(List(U8), _)

Read bytes up to and including the next newline from this buffered reader. A line larger than the platform's 8 MiB materialization limit fails with FileErr(Other(_)); process large records in a format with bounded delimiters.

Returns an empty list at EOF.