Skip to content
Lucent
Esc
↑↓navigate↵open
On this page

lucent/filesystem module

Reads and writes files in the shared Documents/Lucent/data folder.

All scripts use this folder. Paths are relative to it, such as my-script/settings.json. Files can be up to 8 MiB, and a folder listing can contain up to 1,000 entries.

const filesystem = require("lucent/filesystem");

Members

filesystem.exists()

Checks whether a path exists.

filesystem.exists(path: string): Effect.Effect<boolean, FileSystemError>
Name Type Required Default Description
path string

Returns: boolean

Errors: FileSystemError

filesystem.list()

Lists a folder’s contents.

filesystem.list(path?: string): Effect.Effect<readonly FileSystemEntry[], FileSystemError>
Name Type Required Default Description
path string

Returns: readonly FileSystemEntry[]

Errors: FileSystemError

filesystem.readJson()

Reads a JSON file.

filesystem.readJson(path: string): Effect.Effect<unknown | undefined, FileSystemError>
Name Type Required Default Description
path string

Returns: unknown | undefined

Errors: FileSystemError

filesystem.readText()

Reads a text file.

filesystem.readText(path: string): Effect.Effect<string | undefined, FileSystemError>
Name Type Required Default Description
path string

Returns: string | undefined

Errors: FileSystemError

filesystem.remove()

Removes a file or empty folder.

filesystem.remove(path: string): Effect.Effect<void, FileSystemError>
Name Type Required Default Description
path string

Returns: void

Errors: FileSystemError

filesystem.writeJson()

Saves a value as JSON.

filesystem.writeJson(path: string, value: unknown): Effect.Effect<void, FileSystemError>
Name Type Required Default Description
path string
value unknown

Returns: void

Errors: FileSystemError

filesystem.writeText()

Saves text to a file.

filesystem.writeText(path: string, contents: string): Effect.Effect<void, FileSystemError>
Name Type Required Default Description
path string
contents string

Returns: void

Errors: FileSystemError

Type preview
Open page

Last updated on September 26, 2026

Was this page helpful?