Write a file
Pass a path and a byte buffer tofiles.write(). The agent creates any missing parent directories automatically.
- TypeScript
- Python
- Rust
Read a file
files.read() returns the raw bytes of a file. Decode them in your application layer.
- TypeScript
- Python
- Rust
List a directory
files.list() returns the entries in a directory. Each entry includes at minimum a name and a flag indicating whether it is itself a directory.
- TypeScript
- Python
- Rust
Stat a file
files.stat() returns metadata for a single path: name, byte size, whether it is a directory, and the last-modified timestamp.
- TypeScript
- Python
- Rust
Make a directory
Create a directory (and any missing ancestors) withfiles.makeDir() / files.make_dir().
- TypeScript
- Python
- Rust
Move or rename a path
files.move() / files.move_() (Python) moves or renames a file or directory. The destination path must not already exist.
- TypeScript
- Python
- Rust
Remove a path
files.remove() deletes a file or an empty directory. Pass a recursive flag to delete a non-empty directory tree.
- TypeScript
- Python
- Rust
Watch for filesystem changes
files.watch() opens a WebSocket connection and streams inotify events for a path. Pass recursive: true to include all subdirectories. Each event carries the path that changed and the kind of change (create, modify, delete, rename).
- TypeScript
- Python
- Rust
For transferring large files or binary blobs, use
files.upload() and files.download() instead of files.write() and files.read(). These methods stream data in chunks and are designed for file-transfer use cases where reading the entire payload into memory at once is impractical.