> ## 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

> Virtualize an in-memory filesystem from Node or the browser.

`RAMVFS` 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.
It needs no service and no credentials; see the [RAM page](https://docs.mirage.strukto.ai/home/setup/ram.md).

## Install

```bash theme={null}
npm install @struktoai/mirage-node
```

## Configure

```ts 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()
```

`new RAMVFS()` takes no config. `new RAMVFS({ capacity: '100MB' })` caps the
bytes the store holds; a write past it fails with "Disk quota exceeded". See
[capacity](https://docs.mirage.strukto.ai/home/setup/vfs.md#mount-capacity).

## Layout

```text theme={null}
/data/
  note.txt
  reports/
    status.json
```

The mount starts empty. Files and folders exist once a command such as
`touch`, `mkdir`, `tee` or `cp` writes them. The root `/` always exists.

## Browser

`@struktoai/mirage-browser` exports the same `RAMVFS`, with the same options.

```bash theme={null}
npm install @struktoai/mirage-browser
```

```ts theme={null}
import { MountMode, RAMVFS, Workspace } from '@struktoai/mirage-browser'

const ws = new Workspace({ '/data': new RAMVFS() }, { mode: MountMode.WRITE })
```

## Integration

RAM answers these commands from its own tree, so fewer files are read. See
[Integration](https://docs.mirage.strukto.ai/home/integration/overview.md).

* `find`: one recursive listing.
* `du`: one recursive listing.
* `ls -R` and `tree`: one recursive listing.

## VFS.md

The [VFS.md](https://docs.mirage.strukto.ai/home/setup/vfs-md.md) an agent reads with RAM mounted at `/<path>`.
`<mode>` is the mount's mode: `read`, `write` or `exec`. The commands shown are
those of a `write` mount.

> [tab] Rendered
>
> **Virtual Filesystem**
>
> | Path | Description |
> | - | - |
> | `/<path>` | `<mode>` |
>
> **Supported Unix Commands for VFS**
>
> Unix commands work on each path as on a local filesystem, as far as the path supports them:
>
> | Path | Supported |
> | - | - |
> | `/<path>` | Almost all Unix commands. |
>
> **Limitations of Unix Commands for VFS**
>
> Where a path differs from a local filesystem:
>
> | Path | Limitations |
> | - | - |
> | `/<path>` | `grep -r`, `find` and `du` stop after 10000 files; a glob matching more, `tar -c`, `cp -r` and `rm -r` are refused. |
>
> Run `man <cmd>` or `<cmd> --help` for one command's usage.

> [tab] Raw
>
> ```markdown theme={null}
> ---
> name: workspace-filesystem
> description: The virtual filesystem layout of this workspace.
> ---
>
> # Virtual Filesystem
>
> | Path | Description |
> | --- | --- |
> | `/<path>` | `<mode>` |
>
> ## Supported Unix Commands for VFS
>
> Unix commands work on each path as on a local filesystem, as far as the path supports them:
>
> | Path | Supported |
> | --- | --- |
> | `/<path>` | Almost all Unix commands. |
>
> ## Limitations of Unix Commands for VFS
>
> Where a path differs from a local filesystem:
>
> | Path | Limitations |
> | --- | --- |
> | `/<path>` | `grep -r`, `find` and `du` stop after 10000 files; a glob matching more, `tar -c`, `cp -r` and `rm -r` are refused. |
>
> Run `man <cmd>` or `<cmd> --help` for one command's usage.
> ```


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