ilusm.dev

io

Core filesystem I/O surface - the lowest-level ilusm module for reading, writing, appending, listing, checking existence, removing, creating directories, stat, and is-dir checks. The fs and vfs modules delegate here.

Load with: use io

What this module does

io is a one-to-one wrapper over the nine host filesystem syscalls. Each function coerces its path argument to a string and calls the corresponding __sys_* or __io_* native. Higher-level modules (fs, vfs) import and re-export these under friendlier names, but io is available directly if you want the lowest layer.

Quick example

use io

content = io.rd("src/app.ilu")
io.wr("out/app.ilu", content)
io.ap("log.txt", "entry\n")

entries = io.ls("src/")
prn(io.has("src/app.ilu"))  # tru

io.mk("dist/")
io.rm("tmp/scratch.txt")

meta = io.stat("src/app.ilu")
prn(io.is_dir("src/"))

Functions

File operations

iord(path) / io.rd(path)

Reads and returns file contents as a string.

iowr(path, content) / io.wr(path, content)

Writes (overwrites) a file.

ioap(path, content) / io.ap(path, content)

Appends to a file.

iorm(path) / io.rm(path)

Removes the file at path.

Directory operations

iols(dir) / io.ls(dir)

Returns a list of entry names in dir.

iomk(dir) / io.mk(dir)

Creates a directory.

Metadata and checks

ioha(path) / io.has(path)

Returns tru if the path exists. Uses a safe try wrapper around __io_file_exists.

iost(path) / io.stat(path)

Returns file metadata from __sys_stat.

ioid(path) / io.is_dir(path)

Returns tru if path is a directory.

Notes

  • No stdlib dependencies - this is the base I/O layer.
  • All path arguments are coerced to strings with str().