os
This module provides basic filesystem utilities.
| Name | Summary |
|---|---|
| appendFile | Appends content to file, creating it if needed. |
| exists | Returns whether a path exists. |
| listdir | Lists names in a directory. |
| mkdir | Creates a directory with mode 0755. |
| mkdirAll | Creates a directory and all parents with mode 0755. |
| readFile | Reads the entire file and returns its contents as a string. |
| remove | Removes a file or empty directory. |
| stat | Returns a map with keys: size (int), mode (string), isDir (bool), mtime (float seconds). |
| writeFile | Writes content to file, creating/truncating it. |
fn appendFile(path, content) -> null
Appends content to file, creating it if needed.
Parameters
| path | Filesystem path. |
| content | Content to append. |
null
fn exists(path) -> bool
Returns whether a path exists.
Parameters
| path | Path to check. |
bool
fn mkdir(path) -> null
Creates a directory with mode 0755.
Parameters
| path | Directory path. |
null
fn mkdirAll(path) -> null
Creates a directory and all parents with mode 0755.
Parameters
| path | Directory path. |
null
Reads the entire file and returns its contents as a string.
Parameters
| path | Filesystem path to read. |
fn remove(path) -> null
Removes a file or empty directory.
Parameters
| path | Path to remove. |
null
Returns a map with keys: size (int), mode (string), isDir (bool), mtime (float seconds).
Parameters
| path | Path to stat. |
fn writeFile(path, content) -> null
Writes content to file, creating/truncating it.
Parameters
| path | Filesystem path. |
| content | Content to write. |
null