Skip to content

Search

Documentation

fs module

Files on disk, project-relative unless the path is absolute. A packed build's contents are reached through assets and scene.source.

本页内容

Files on disk, project-relative unless the path is absolute. A packed build's contents are reached through assets and scene.source.

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(from: string, to: 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(path: string) — Create a project-relative directory and every parent it needs.
exists(path: string) — Whether a project-relative path has anything at it, file or directory.
list(path: string) — A directory's entries as { name, is_dir }, sorted, dotfiles skipped; empty for a directory that is not there.
modified_time(path: string) — When a file last changed, in seconds since the Unix epoch; nil for one that is not there.
read(path: string) — A whole file as text, project-relative unless absolute; nil when it cannot be read.
remove(path: string) — Delete a project-relative file, or a directory and everything under it; false when there was nothing there.
rename(from: string, to: string) — Move a project-relative file or directory, creating the destination's parent first.
write(path: string, text: string) — Write text to a project-relative file, creating the directory it goes in.