@vertz/desktop package provides a file system API for Vertz desktop apps running in the native webview. Every operation returns a Result<T, DesktopError> — errors are values, not exceptions.
Setup
Result error if called outside that environment.
Permissions
File system access requires permissions declared in.vertzrc:
Text files
Reading text
Writing text
Binary files
Binary file operations use HTTP transport instead of JSON IPC, avoiding the 33% overhead of base64 encoding.Reading binary data
Returns the entire file as aUint8Array. Files larger than 2 GiB return an error suggesting readBinaryStream().
Writing binary data
Writes aUint8Array to a file. The write is atomic — data is written to a temp file first, then renamed into place for crash safety. Parent directories are created automatically.
Streaming binary reads
For files larger than 2 GiB or when you want to process data incrementally, usereadBinaryStream(). Returns a ReadableStream<Uint8Array> — no size limit, data arrives chunk by chunk.
Streaming binary writes
Write data from aReadableStream<Uint8Array> to a file. No size limit — data flows chunk by chunk. The write is atomic (temp file + rename).
Directory operations
Check existence
File metadata
List directory
Create directory
Remove
Removes a file or directory. Directories are removed recursively.Rename / move
Timeouts
All operations accept an optionaltimeout (milliseconds):