fs
luau
local fs = require("@std/fs")fs.close
luau
(file: file) -> ()fs.copy
luau
(src: pathlike, dest: pathlike) -> ()fs.createdirectory
luau
(path: pathlike, options: createdirectoryoptions?) -> ()fs.exists
luau
(path: pathlike) -> booleanfs.link
luau
(src: pathlike, dest: pathlike) -> ()fs.listdirectory
luau
(path: pathlike) -> { directoryentry }fs.metadata
luau
(path: pathlike) -> metadatafs.open
luau
(path: pathlike, mode: handlemode?) -> filefs.read
luau
(file: file) -> stringfs.readfiletostring
luau
(filepath: pathlike) -> stringfs.remove
luau
(path: pathlike) -> ()fs.removedirectory
luau
(path: pathlike, options: removedirectoryoptions?) -> ()fs.symboliclink
luau
(src: pathlike, dest: pathlike) -> ()fs.type
luau
(path: pathlike) -> typefs.walk
Note: for loops do not support yielding generalized iterators, so we cannot use fs.walk as for path in fs.walk(...) do directly. A while loop can be used instead. See example/walk_directory.luau for usage.
luau
(path: pathlike, options: walkoptions?) -> () -> path?fs.watch
Iterator function that yields filename and event pairs when changes occur in the watched path.
Also provides a close method to stop watching.
Note: for loops do not support yielding generalized iterators, so we cannot use fs.watch as for _ in fs.watch(...) do directly. A while loop can be used instead. See example/watch_directory.luau for usage.
luau
(path: pathlike) -> watcherfs.write
luau
(file: file, contents: string) -> ()fs.writestringtofile
luau
(filepath: pathlike, contents: string) -> ()