---
url: >-
  https://adk.nht.io/api/@nhtio/adk/batteries/media/contracts/interfaces/ScratchWorkspace.md
description: >-
  Bytes ⇄ executor-visible paths. The seam that lets binary-backed engines
  exchange files with the process (or remote runner) that executes them.
---

# Interface: ScratchWorkspace

Defined in: [src/batteries/media/contracts.ts:109](https://github.com/NHTIO/ADK/blob/v1.20260713.1/src/src/batteries/media/contracts.ts#L109)

Bytes ⇄ executor-visible paths. The seam that lets binary-backed engines exchange files
with the process (or remote runner) that executes them.

## Methods

### dir()

```ts
dir(): string;
```

Defined in: [src/batteries/media/contracts.ts:127](https://github.com/NHTIO/ADK/blob/v1.20260713.1/src/src/batteries/media/contracts.ts#L127)

The workspace root directory, for `--outdir`-style binary arguments.

#### Returns

`string`

***

### dispose()

```ts
dispose(): Promise<void>;
```

Defined in: [src/batteries/media/contracts.ts:131](https://github.com/NHTIO/ADK/blob/v1.20260713.1/src/src/batteries/media/contracts.ts#L131)

Remove the workspace and everything in it. Engines call this in `finally`.

#### Returns

`Promise`<`void`>

***

### list()

```ts
list(): Promise<string[]>;
```

Defined in: [src/batteries/media/contracts.ts:129](https://github.com/NHTIO/ADK/blob/v1.20260713.1/src/src/batteries/media/contracts.ts#L129)

List the files currently in the workspace root (basenames).

#### Returns

`Promise`<`string`\[]>

***

### materialize()

```ts
materialize(bytes: Uint8Array, filename: string): Promise<string>;
```

Defined in: [src/batteries/media/contracts.ts:118](https://github.com/NHTIO/ADK/blob/v1.20260713.1/src/src/batteries/media/contracts.ts#L118)

Write `bytes` into the workspace under `filename` and return the absolute path the
paired executor can open.

#### Parameters

| Parameter  | Type         | Description                                                          |
| ---------- | ------------ | -------------------------------------------------------------------- |
| `bytes`    | `Uint8Array` | The content to materialize.                                          |
| `filename` | `string`     | The basename to use (extension matters to format-sniffing binaries). |

#### Returns

`Promise`<`string`>

The absolute path.

***

### read()

```ts
read(path: string): Promise<Uint8Array<ArrayBufferLike>>;
```

Defined in: [src/batteries/media/contracts.ts:125](https://github.com/NHTIO/ADK/blob/v1.20260713.1/src/src/batteries/media/contracts.ts#L125)

Read a file the executor produced inside the workspace.

#### Parameters

| Parameter | Type     | Description                |
| --------- | -------- | -------------------------- |
| `path`    | `string` | The absolute path to read. |

#### Returns

`Promise`<`Uint8Array`<`ArrayBufferLike`>>

The file bytes.
