Skip to content

fs

local fs = require("@rodeo/fs")
EntryDescription
DirectoryEntryName + type pair returned by listdir for each child of a directory.
FileMetadataMetadata for a filesystem entry — size, type, timestamps. Returned by stat.
copyCopies the file at src to dest. Overwrites dest if it exists.
existsReturns true if a file or directory exists at path.
listdirReturns directory entries (name + type) for the immediate children of path.
mkdirCreates a directory at path.
openOpens the file at path in mode ("r", "w", "a", etc.). Returns a
removeRemoves the file at path.
rmdirRemoves the directory at path. Fails if non-empty.
statReturns metadata (size, type, timestamps) for the file or directory at path.
typeReturns the type of the entry at path as a string — e.g. "file", "dir".

Name + type pair returned by listdir for each child of a directory.

type DirectoryEntry = runtime.FsDirEntry

Metadata for a filesystem entry — size, type, timestamps. Returned by stat.

type FileMetadata = runtime.FsStatResponse

Copies the file at src to dest. Overwrites dest if it exists.

(src: string, dest: string) -> ()

Returns true if a file or directory exists at path.

(path: string) -> boolean

Returns directory entries (name + type) for the immediate children of path.

(path: string) -> { DirectoryEntry }

Creates a directory at path.

(path: string) -> ()

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.StreamHandle

Removes the file at path.

(path: string) -> ()

Removes the directory at path. Fails if non-empty.

(path: string) -> ()

Returns metadata (size, type, timestamps) for the file or directory at path.

(path: string) -> FileMetadata

Returns the type of the entry at path as a string — e.g. "file", "dir".

(path: string) -> string