Skip to main content
The File System API provides comprehensive file management capabilities for working with files and directories within sandbox environments.

Overview

Daytona’s file system operations support:
  • File upload/download - Transfer files between local system and sandbox
  • Directory management - Create, list, and navigate directories
  • File search - Search by name patterns or content
  • Batch operations - Process multiple files efficiently

File Upload

Upload from Buffer

Upload file content directly from memory:

Upload from Local File

Upload a file from your local filesystem:

Upload Multiple Files

Efficiently upload multiple files in a single operation:
FileUpload[]
required
Array of files to upload
number
Upload timeout in seconds. Default is 30 minutes (1800 seconds). Set to 0 for no timeout.

File Download

Download to Buffer

Download a file into memory:

Download to Local File

Download and save to your local filesystem:

Download Multiple Files

Download multiple files efficiently:
FileDownloadRequest[]
required
Array of download requests
number
Download timeout in seconds. Default is 30 minutes (1800 seconds).

Directory Management

Create Directory

List Directory Contents

Get File Details

File Operations

Move or Rename Files

Delete Files or Directories

Set File Permissions

string
required
Path to file or directory. Relative paths resolved from sandbox working directory.
FilePermissionsParams
required
Permission settings

Search by Name Pattern

Find files using glob patterns:

Search by Content

Search for text patterns within files:

Text Replacement

Replace in Multiple Files

Find and replace text across multiple files:
string[]
required
Array of file paths. Relative paths resolved from sandbox working directory.
string
required
Text pattern to replace
string
required
Replacement text

Best Practices

When uploading or downloading large files, provide a local file path instead of using buffers to enable streaming and avoid memory issues.
Use batch upload/download operations when working with multiple files to reduce network overhead.
Check for errors in batch operations, as individual files may fail while others succeed.
While relative paths are resolved based on the sandbox working directory, using absolute paths makes your code more explicit and prevents confusion.

Complete Example

Process Execution

Execute commands and code in sandboxes

Git Operations

Clone and manage Git repositories