.desktop.fs
The File System API reads and writes files inside Liatir-managed storage scopes. Node, Python, R and Native can all use it. These scopes organize bridge access; they do not sandbox the language's own operating-system APIs. WASM uses its own sandbox mounts and has no access to this bridge.
Overview
The API area is organized into several main scopes, each serving a specific purpose:
- cache: Temporary storage that should always be used for cached data that can be purged without loss of critical information.
- data: Persistent storage for application data and files.
- pluginFs / plugin_fs: Persistent storage of a specified plugin.
Use paths relative to the chosen scope. During liatir dev, storage is redirected to the temporary session and workspace; it is removed at session end.
Scopes
FsPaths
| Field | Type | Description |
|---|---|---|
cache | string | Base path for the cache scope. |
data | string | Base path for the data scope. |
FsScopeMethods
Methods available on data, cache, and pluginFs / plugin_fs scopes.
FsEntry
| Field | Type | Description |
|---|---|---|
name | string | The name of the file or directory. |
path | string | The full path to the entry within the scope. |
is_dir | boolean | Whether the entry is a directory. |
size | number or null | File size in bytes; null for directories. |
IMPORTANT
FsEntry uses name, path, is_dir and size in every language. The SDK preserves the backend JSON response without renaming fields.
FsPluginMethods
All the following methods only apply within the specified plugin storage scope. They are identical to
FsScopeMethodswith one addition:
Example Usage
Notes
TIP
The cache namespace is intended for temporary files that will be cleared, while data and pluginFs / plugin_fs namespaces are meant for persistent files that should be preserved across sessions.
Paths passed to this API stay within their managed scope. Node, Python, R and Native programs can separately use their language's filesystem APIs; this bridge is not an operating-system sandbox.
R and Native remove their temporary Job directory at termination. If returning a file path, write it to managed storage first and return that absolute path, or return inline content. Use unique paths per run to avoid overwriting another concurrent run's output.