ump-plugin-filesystem
v0.0.1
Published
UMP Filesystem Plugin — async read / write / delete for app-scoped paths (`documents/`, `cache/`).
Readme
ump-plugin-filesystem
UMP Filesystem Plugin — async read / write / delete for app-scoped paths
(documents/, cache/).
Install
npm install ump-plugin-filesystem --save
Usage
import { FS } from 'ump-plugin-filesystem'; // see src/index.ts
await FS.writeFile(FS.documentsDir + 'note.txt', 'hello world'); const text = await FS.readFile(FS.documentsDir + 'note.txt');
if (await FS.exists(FS.cacheDir + 'thumbs')) { const entries = await FS.readDir(FS.cacheDir + 'thumbs'); }
await FS.mkdir(FS.documentsDir + 'logs'); await FS.deleteFile(FS.documentsDir + 'note.txt');
All methods return Promises. When the native bridge
(__ump_fs_* host functions) is missing the methods resolve to safe
defaults (null for reads, false for mutations) so callers can degrade
without try/catch.
See src/index.ts for the full API.
Plugin authoring
This is a UMP plugin. See docs/superpowers/specs/plugin-authoring-guide.md for the plugin model.
