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

# RAM

> Keep scratch files in memory with no service and no credentials.

![](https://mintcdn.com/struktoai/F9Lv_nTaj6By6crk/images/python-logo.svg?fit=max\&auto=format\&n=F9Lv_nTaj6By6crk\&q=85\&s=cf5b268d330f7db46ea5cf6083f309a1)

Node.js

Browser

![](https://mintcdn.com/struktoai/CsxMCKUyfoQQJYHB/images/cloudflare-logo.svg?fit=max\&auto=format\&n=CsxMCKUyfoQQJYHB\&q=85\&s=23668457afa14abb3b0db0f5b9c0541a)

RAM keeps files in process memory, for scratch work, tests and trying Mirage.
The mount starts empty and its files are gone when the process exits.

## Connect

> [tab] YAML
>
> ```yaml workspace.yaml theme={null}
> mounts:
>   /data:
>     vfs: ram
>     mode: write
> ```
>
> ```bash theme={null}
> mirage workspace create workspace.yaml --id scratch
> mirage shell -w scratch -c 'echo hello > /data/note.txt && cat /data/note.txt'
> ```

> [tab] Python
>
> ```python theme={null}
> from mirage import MountMode, Workspace
> from mirage.vfs.ram import RAMVFS
>
> ws = Workspace({"/data": RAMVFS()}, mode=MountMode.WRITE)
> result = await ws.shell("echo hello > /data/note.txt && cat /data/note.txt")
> print(await result.stdout_str())
> await ws.close()
> ```

> [tab] TypeScript
>
> ```typescript theme={null}
> import { MountMode, RAMVFS, Workspace } from '@struktoai/mirage-node'
>
> const ws = new Workspace({ '/data': new RAMVFS() }, { mode: MountMode.WRITE })
> const result = await ws.shell('echo hello > /data/note.txt && cat /data/note.txt')
> console.log(result.stdoutText)
> await ws.close()
> ```

## Layout

```text theme={null}
/data/
  note.txt
  reports/
    q1.csv
```

* Files and folders exist only once a command writes them.
* Runs in Python, Node and browsers; see the
  [browser quickstart](https://docs.mirage.strukto.ai/typescript/browser-quickstart.md).
* `capacity: 100MB` under `config` caps the bytes it holds; a write past it
  fails with "Disk quota exceeded". See [capacity](https://docs.mirage.strukto.ai/home/setup/vfs.md#mount-capacity).

## Sample runs

```bash theme={null}
$ tree /data
/data
|-- note.txt
`-- reports
    `-- q1.csv

2 directories, 2 files
```

```bash theme={null}
$ sort -t, -k2 -n /data/reports/q1.csv
region,revenue
east,95
west,120
```

```bash theme={null}
$ head -c 2000 /dev/zero > /data/big.bin
bash: line 1: /data/big.bin: Disk quota exceeded
```

The last run is on a mount with `capacity: 1KB`. Every command that writes
works here: `cp`, `mv`, `rm`, `mkdir`, `tee` and redirects.

## SDK guides

> [card] [Python](https://docs.mirage.strukto.ai/python/vfs/ram.md)
>
> Every config field, the VFS.md and write support.

> [card] [TypeScript](https://docs.mirage.strukto.ai/typescript/vfs/ram.md)
>
> Every config field, the VFS.md and write support.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.