File system. import fs, effect.
Read file contents as a UTF-8 string
let text = fs.read_text("config.toml")
Read file contents as a list of bytes
let bytes = fs.read_bytes("image.png")
Write a string to a file, creating or overwriting it
fs.write("output.txt", "hello")
Write a list of bytes to a file
fs.write_bytes("out.bin", [0, 1, 2])
Append a string to a file, creating it if it doesn't exist
fs.append("log.txt", "new line\n")
Create a directory and all parent directories
fs.mkdir_p("data/cache/images")
Check if a file or directory exists
if fs.exists("config.toml") then ...
Read a file as a list of lines
let lines = fs.read_lines("data.csv")
Delete a file
fs.remove("temp.txt")
List entries in a directory
let entries = fs.list_dir("src/")
Check if a path is a directory
if fs.is_dir("src") then ...
Check if a path is a regular file
if fs.is_file("readme.md") then ...
Copy a file from src to dst
fs.copy("a.txt", "b.txt")
Rename or move a file
fs.rename("old.txt", "new.txt")
Recursively list all files in a directory tree
let all_files = fs.walk("src/")
Recursively delete a directory and all its contents
fs.remove_all("build/")
Get file size in bytes
let size = fs.file_size("data.bin")
Get the system temporary directory path
let tmp = fs.temp_dir()
Get file metadata: size, type, and modification time
let info = fs.stat("file.txt") // {size, is_dir, is_file, modified}
Find files matching a glob pattern
let files = fs.glob("src/**/*.almd")
Create a temporary file with a given prefix, return its path
let path = fs.create_temp_file("almide-")
Create a temporary directory with a given prefix, return its path
let dir = fs.create_temp_dir("build-")
Check if a path is a symbolic link
if fs.is_symlink("link") then ...
Get file modification time as Unix timestamp (seconds)
let ts = fs.modified_at("file.txt")