> ## Documentation Index
> Fetch the complete documentation index at: https://e2b.manicule.dev/llms.txt
> Use this file to discover all available pages before exploring further.
> For every page in one file, fetch https://e2b.manicule.dev/llms-full.txt (large).
> To search and read these docs as tools, connect the MCP server at https://e2b.manicule.dev/api/mcp.
> Every agent surface: https://e2b.manicule.dev/.well-known/llms-manifest.json

# Read & write files (/docs/filesystem/read-write)

<!-- agent-signals: reading_time_min: 1 · est_tokens: 366 · updated: 2026-07-30 -->
Related: [Download data from sandbox](/docs/filesystem/download.md), [Get information about a file or directory](/docs/filesystem/info.md), [Attach custom metadata to files](/docs/filesystem/metadata.md), [Upload data to sandbox](/docs/filesystem/upload.md), [Watch sandbox directory for changes](/docs/filesystem/watch.md)

## Reading files

You can read files from the sandbox filesystem using the `files.read()` method.

<CodeGroup>
```js title="JavaScript & TypeScript"
import { Sandbox } from 'e2b'

const sandbox = await Sandbox.create()
const fileContent = await sandbox.files.read('/path/to/file')
```

```python title="Python"
from e2b import Sandbox

sandbox = Sandbox.create()
file_content = sandbox.files.read('/path/to/file')
```
</CodeGroup>

## Writing single files

You can write single files to the sandbox filesystem using the `files.write()` method.

<CodeGroup>
```js title="JavaScript & TypeScript"
import { Sandbox } from 'e2b'

const sandbox = await Sandbox.create()

await sandbox.files.write('/path/to/file', 'file content')
```

```python title="Python"
from e2b import Sandbox

sandbox = Sandbox.create()

sandbox.files.write('/path/to/file', 'file content')
```
</CodeGroup>

## Writing multiple files

You can also write multiple files to the sandbox.

<CodeGroup>
```js title="JavaScript & TypeScript"
import { Sandbox } from 'e2b'

const sandbox = await Sandbox.create()

await sandbox.files.write([
    { path: '/path/to/a', data: 'file content' },
    { path: '/another/path/to/b', data: 'file content' }
])
```

```python title="Python"
from e2b import Sandbox

sandbox = Sandbox.create()

sandbox.files.write_files([
    { "path": "/path/to/a", "data": "file content" },
    { "path": "another/path/to/b", "data": "file content" }
])
```
</CodeGroup>
