---
id: fs
title: Fs
order: 6
---
The filesystem, wrapped into one safe, ergonomic API — no file descriptors, no byte buffers, no half-written files. The foundation for saves, config, mods, and asset loading: read and write whole files as text, check existence, make directories, copy, and list a folder. The bare file_* builtins remain underneath for streaming; Fs.* is the everyday layer.
Fallible calls surface failure as a value — null, false, or -1 — that you branch on, never a crash (a first-class try/else lands with the error-handling work). Writes are atomic (written to a temporary file and renamed into place), so a crash mid-write never corrupts the previous file. list returns entries sorted, so a directory walk is reproducible across runs and platforms.
Paths are /-separated over the native (macOS/BSD) filesystem — the fully supported target today; a sandboxed virtual filesystem for wasm and recursive directory copy are follow-ups. Text helpers are UTF-8 (they pair with Unicode); use Path to build the paths and Os for per-user locations.