This library is in flux. APIs may change without notice. Generated from source with koruc 0.1.7 on 8/19/2026.
FS
~import std/fsKoru Standard Library: Filesystem
fs.kz · 2 tors · ~[comptime]· ~[runtime]
Koru Standard Library: Filesystem
File operations with phantom types for resource safety
~[
- aspirational
read-lines exposes a per-line streaming surface but its implementation
SLURPS the whole file into memory (readToEndAlloc), so it is bounded by RAM
and OOMs on inputs larger than memory. The honest fix is true line-by-line
streaming - constant memory, any file size - deferred to a dedicated session.
Marked aspirational so the gap is explicit and greppable, never hidden behind
a clean API. Discipline to close it: a future --allow-aspirational gate flag
plus koruc --list-aspirational. See the no-silent-degradation doctrine.
]pub tor read-lines { path: string }
! line string
| done usize
| failed stringwrite
koru_std/fs.kz:77// Write a buffer to a path. The caller's slice is borrowed for the duration
// of the write; the file owns the bytes after `| written`. `| failed` is
// the same loud strings `read-lines` uses on open, plus write-side I/O.
// No cap: the host writes `content` as given. The file is the owner after `| written`.
~pub tor write { path: string, content: string }
| written
| failed string