fs
local fs = require("@rodeo/fs")Summary
Section titled “Summary”| Entry | Description |
|---|---|
| DirectoryEntry | Name + type pair returned by listdir for each child of a directory. |
| FileMetadata | Metadata for a filesystem entry — size, type, timestamps. Returned by stat. |
| copy | Copies the file at src to dest. Overwrites dest if it exists. |
| exists | Returns true if a file or directory exists at path. |
| listdir | Returns directory entries (name + type) for the immediate children of path. |
| mkdir | Creates a directory at path. |
| open | Opens the file at path in mode ("r", "w", "a", etc.). Returns a |
| remove | Removes the file at path. |
| rmdir | Removes the directory at path. Fails if non-empty. |
| stat | Returns metadata (size, type, timestamps) for the file or directory at path. |
| type | Returns the type of the entry at path as a string — e.g. "file", "dir". |
DirectoryEntry
Section titled “DirectoryEntry”Name + type pair returned by listdir for each child of a directory.
type DirectoryEntry = runtime.FsDirEntryFileMetadata
Section titled “FileMetadata”Metadata for a filesystem entry — size, type, timestamps. Returned by stat.
type FileMetadata = runtime.FsStatResponseFunctions and Properties
Section titled “Functions and Properties”fs.copy
Section titled “fs.copy”Copies the file at src to dest. Overwrites dest if it exists.
(src: string, dest: string) -> ()fs.exists
Section titled “fs.exists”Returns true if a file or directory exists at path.
(path: string) -> booleanfs.listdir
Section titled “fs.listdir”Returns directory entries (name + type) for the immediate children of path.
(path: string) -> { DirectoryEntry }fs.mkdir
Section titled “fs.mkdir”Creates a directory at path.
(path: string) -> ()fs.open
Section titled “fs.open”Opens the file at path in mode ("r", "w", "a", etc.). Returns a
stream handle usable with stream.read, stream.write, stream.close.
(path: string, mode: string?) -> stream.StreamHandlefs.remove
Section titled “fs.remove”Removes the file at path.
(path: string) -> ()fs.rmdir
Section titled “fs.rmdir”Removes the directory at path. Fails if non-empty.
(path: string) -> ()fs.stat
Section titled “fs.stat”Returns metadata (size, type, timestamps) for the file or directory at path.
(path: string) -> FileMetadatafs.type
Section titled “fs.type”Returns the type of the entry at path as a string — e.g. "file", "dir".
(path: string) -> string