SDK
Filesystem
nano.fs is a typed view over the in-VM POSIX filesystem: a synchronous fast path backed by MemFS, and an async path that shells out to BusyBox for real mutation semantics.
Fast path (synchronous)
These touch MemFS directly — no VM step, no await. Ideal for seeding inputs before a run and reading results after.
Method
Returns
writeFile(path, content, mode?)
void — create or overwrite
readText(path)
string | null
readFile(path)
Uint8Array | null
list(path)
DirEntry[] | null
exists(path)
boolean
walk(root?)
string[] — recursive file list
javascript
nano.fs.writeFile("/app/index.ts", "export const x = 1;");
const src = nano.fs.readText("/app/index.ts");
const all = nano.fs.walk("/app");Mutation path (async)
mkdir, remove, move and copy run through BusyBox for correct (recursive) semantics; loadTarGz unpacks a .tar.gz into the filesystem.
Method
Purpose
mkdir(path)
create a directory (recursively)
remove(path)
delete a file or directory
move(from, to)
rename / move
copy(from, to)
copy
loadTarGz(buffer)
unpack an archive into the FS
Permissions
writeFile takes an optional octal mode. Pass 0o755 to make a file executable — for example a binary you want resolvable on PATH. The default is 0o644.
javascript
nano.fs.writeFile("/usr/bin/tool", bytes, 0o755);Lazy files
registerLazyFile records a path plus { size, mode, resolve() } — the bytes are fetched on first guest access. The catalog uses this for install-on-demand.
DirEntry is { name, type: "dir" | "file" | "symlink", size }.