> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fermion.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Write to files inside your Sandbox Instance

> Write text or binary files to the sandbox filesystem with automatic directory creation.

The `writeFile()` method allows you to create or overwrite files inside your sandbox’s isolated filesystem. It supports both **text** and **binary** content. All file paths must begin with the absolute sandbox path `/home/damner`.

### `writeFile(options)`

**Description:**
Writes a file to the sandbox filesystem. Supports both text and binary content.

**Parameters:**

| Parameter | Type                  | Required | Description                                |
| --------- | --------------------- | -------- | ------------------------------------------ |
| path      | string                | Yes      | File path (must start with `/home/damner`) |
| content   | string \| ArrayBuffer | Yes      | File content (text string or binary data)  |

**Returns:**
`Promise<void>` - Resolves when write is complete

**Example:**

````typescript theme={null}
// Text file
await sandbox.writeFile({
  path: '/home/damner/script.js',
  content: 'console.log("Hello World")'
})

**Path Handling:**
```typescript
// Valid paths
await sandbox.writeFile({ path: '/home/damner/file.js', content: '...' })

// Invalid paths
await sandbox.writeFile({ path: '/tmp/file.js', content: '...' })
await sandbox.writeFile({ path: 'relative/file.js', content: '...' })
await sandbox.writeFile({ path: './file.js', content: '...' })
````

***
