fs
Files on disk, project-relative unless the path is absolute. In a packed build read, exists and list reach what the pack holds.
On this page
Files on disk, project-relative unless the path is absolute. In a packed build read, exists and list reach what the pack holds.
9 functions, 0 constants. Scripts reach it as fs::.
Functions
Argument kinds are the script values a call passes: node is a node handle, any a table or value of any kind, fn a callback.
| function | acts on | what it does |
|---|---|---|
copy(string, string) |
— | Copy a file byte for byte, creating the destination's parent first. What read and write cannot do for an image or a model. |
create_directory(string) |
— | Create a project-relative directory and every parent it needs. |
exists(string) -> bool |
— | Whether a project-relative path has anything at it, file or directory. |
list(string) -> [fs::Entry] |
— | A directory's entries as { name, is_dir }, sorted, dotfiles skipped; empty for a directory that is not there. |
modified_time(string) -> float? |
— | When a file last changed, in seconds since the Unix epoch; nil for one that is not there. |
read(string) -> str? |
— | A whole file as text, project-relative unless absolute and found inside the pack in a packed run; nil when it cannot be read. |
remove(string) -> bool |
— | Delete a project-relative file, or a directory and everything under it; false when there was nothing there. |
rename(string, string) |
— | Move a project-relative file or directory, creating the destination's parent first. |
write(string, string) |
— | Write text to a project-relative file, creating the directory it goes in. The text lands in a file beside it, synced, then renamed over it, so a crash mid-write keeps the old file whole. |