@tinycloud/vfs mounts TinyCloud data as a Node.js virtual file system. In this first cut it is KV-only: files and directories are backed by TinyCloud KV in the underlying space or delegated subtree. It is meant for Node runtimes, not the browser.
Access Modes
TinyCloud VFS supports two entry points:- Owner access uses an authenticated
TinyCloudNodeinstance and mounts your own space - Delegated access uses a portable delegation and mounts the delegator’s scoped subtree
await createTinyCloudDelegatedVfs(...).
Installation
Owner Usage
UsecreateTinyCloudVfsFromNode(node) when the process owns the TinyCloud session.
Delegated Usage
Useawait createTinyCloudDelegatedVfs({ node, delegation }) when you want to mount a path that was granted through delegation.
Live-Tested Behavior
These examples were validated against the live Node coverage added in js-sdk PR #194.- Owner mounts support read, write, stat, list, rename, unlink, and
rmdir - Delegated mounts can read and write within the delegated subtree
- Read-only delegations reject writes with
EACCES
Cleanup
The current examples explicitly callvfs.unmount() and then provider.close(). Keep that order in your own code: unmount first, then close the provider.
