Filesystem
API for filesystem-related functions.
Functions
Filesystem.toAbsolutePath
Converts a relative path to an absolute path.
Filesystem.toAbsolutePath(path: string, base?: string): string
Parameters
Name | Type | Default Value | Description |
---|---|---|---|
path | string | Required | The path to convert. |
base | string? | nil | The base path to use. |
Returns
Name | Type | Description |
---|---|---|
absolutePath | string | The absolute path. |
Filesystem.readFile
Reads a file.
Filesystem.readFile(relativePath: string): buffer
Parameters
Name | Type | Default Value | Description |
---|---|---|---|
relativePath | string | Required | The relative path to the file. |
Returns
Name | Type | Description |
---|---|---|
contents | buffer | The contents of the file. |
Filesystem.fileExists
Checks if a file exists.
Filesystem.fileExists(path: string): boolean
Parameters
Name | Type | Default Value | Description |
---|---|---|---|
path | string | Required | The path to the file relative to the script directory. |
Returns
Name | Type | Description |
---|---|---|
exists | boolean | True if the file exists, false otherwise. |