Related
- CLI File Operations - File operations from CLI
What You’ll Learn
- How to read and write files in sandboxes
- How to list directories and navigate the filesystem
- How to upload and download files to/from sandboxes
- How to watch files for changes
- How to manage file permissions and metadata
File Operations Overview
| Operation | SDK Method | API Endpoint |
|---|---|---|
| Reading | sandbox.files.read() | GET /files/read |
| Writing | sandbox.files.write() | POST /files/write |
| Listing | sandbox.files.list() | GET /files/list |
| Uploading | sandbox.files.upload() | POST /files/upload |
| Downloading | sandbox.files.download() | GET /files/download |
| Watching | sandbox.files.watch() | WebSocket /files/watch |
Core Concepts
Reading Files
Read file contents from sandboxes as text or binary data.- Reading Files - Read file contents
- SDK: Python: sandbox.files.read() | JavaScript: sandbox.files.read()
- API: GET /files/read
Writing Files
Write text or binary data to files in sandboxes.- Writing Files - Write file contents
- SDK: Python: sandbox.files.write() | JavaScript: sandbox.files.write()
- API: POST /files/write
Listing Files
List directory contents and navigate the filesystem.- Listing Files - List directories and files
- SDK: Python: sandbox.files.list() | JavaScript: sandbox.files.list()
- API: GET /files/list
Uploading Files
Upload files from your local machine to sandboxes.- Uploading Files - Upload files to sandboxes
- SDK: Python: sandbox.files.upload() | JavaScript: sandbox.files.upload()
- API: POST /files/upload
Downloading Files
Download files from sandboxes to your local machine.- Downloading Files - Download files from sandboxes
- SDK: Python: sandbox.files.download() | JavaScript: sandbox.files.download()
- API: GET /files/download
Watching Files
Watch files and directories for changes in real-time.- Watching Files - Monitor file changes
- SDK: Python: sandbox.files.watch() | JavaScript: sandbox.files.watch()
- API: WebSocket /files/watch
SDK Reference
Python SDK
Complete reference for Python file operations.- Files Module - Complete filesystem API
files.read()- Read filesfiles.write()- Write filesfiles.list()- List directoriesfiles.upload()- Upload filesfiles.download()- Download filesfiles.watch()- Watch filesfiles.exists()- Check existencefiles.remove()- Delete filesfiles.mkdir()- Create directories
JavaScript SDK
Complete reference for JavaScript/TypeScript file operations.- Files Module - Complete filesystem API
files.read()- Read filesfiles.write()- Write filesfiles.list()- List directoriesfiles.upload()- Upload filesfiles.download()- Download filesfiles.watch()- Watch filesfiles.exists()- Check existencefiles.remove()- Delete filesfiles.mkdir()- Create directories
API Reference
VM Agent API
REST API endpoints for file operations.- VM Agent API Overview - API overview
- Read File -
GET /files/read- Read file contents - Write File -
POST /files/write- Write file contents - List Files -
GET /files/list- List directory contents - File Exists -
GET /files/exists- Check file existence - Remove File -
DELETE /files/remove- Delete files - Create Directory -
POST /files/mkdir- Create directories
Quick Start
If you’re new to file operations, start here:- Reading Files - Read your first file
- Writing Files - Write files to sandboxes
- Listing Files - Navigate directories
Related Topics
- Code Execution - Execute code that works with files
- Sandboxes - Create sandboxes for file operations
- Commands - Run shell commands for file operations
- Environment Variables - Configure file paths
Next Steps
- Learn about Code Execution to process files
- Explore Commands for shell-based file operations
- Review Uploading Files for bulk transfers
- Check out Watching Files for real-time monitoring

