Skip to content
1 min read · 202 words

Interface: ScratchWorkspace ​

Defined in: src/batteries/media/contracts.ts:109

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

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

Returns ​

string


dispose() ​

ts
dispose(): Promise<void>;

Defined in: src/batteries/media/contracts.ts:131

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

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

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

Parameters ​

ParameterTypeDescription
bytesUint8ArrayThe content to materialize.
filenamestringThe 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

Read a file the executor produced inside the workspace.

Parameters ​

ParameterTypeDescription
pathstringThe absolute path to read.

Returns ​

Promise<Uint8Array<ArrayBufferLike>>

The file bytes.