@uipath/filesystem
Cross-platform filesystem abstraction for the UiPath CLI. Provides a unified interface for file operations in both Node.js and browser environments. The browser implementation uses LightningFS with IndexedDB-backed persistence.
Installation
npm install @uipath/filesystem
Usage
import { getFileSystem } from "@uipath/filesystem";
const fs = getFileSystem();
const content = await fs.readFile("config.json", "utf-8");
await fs.writeFile("output/result.json", JSON.stringify(data));
const full = fs.path.join(fs.env.homedir(), ".uipath", "config.json");
if (await fs.exists(full)) {
const stats = await fs.stat(full);
}
API
getFileSystem() / getFileSystemAsync()
Returns a singleton IFileSystem instance.
IFileSystem
readFile(path, options?) | Read file as Uint8Array or UTF-8 string |
writeFile(path, data) | Write file, creating parent directories |
readdir(path) | List directory contents |
stat(path) | Get file stats (type, size, mtime) |
exists(path) | Check if path exists |
mkdir(path) | Create directory recursively |
rm(path) | Remove file or directory recursively |
rename(old, new) | Rename or move a file |
getTempDir() | Create an isolated temp directory |
copyDirectory(src, dest) | Recursive directory copy |
Namespaces
fs.path | Path operations: join, resolve, relative, dirname, basename, isAbsolute |
fs.env | Environment: cwd(), homedir(), tmpdir(), getenv(key) |
License
See the root repository for license information.
Browser Storage Migration
The browser backend now uses LightningFS instead of ZenFS. Existing browser-side data stored through the old ZenFS backend is not migrated and can be discarded.