NodeOps
UK

Sandbox Files

SandboxFiles handles raw file transfer between your process and the sandbox filesystem. Reach it via sandbox.files on a Sandbox handle.

Every method also throws CreateosSandboxServerError on a 5xx response and CreateosSandboxConnectionError on network failure.


upload

TypeScript
1async upload(path: string, data: BodyInit, options?: RequestOptions): Promise<void>

Uploads raw bytes to an absolute path inside the sandbox. The destination directories must already exist. Any existing file at path is overwritten.

Parameters

NameTypeDescription
pathstringAbsolute path inside the sandbox, e.g. /srv/index.html.
dataBodyInitContent to write — string, Blob, ArrayBuffer, ReadableStream, FormData, or URLSearchParams.
options?RequestOptionsPer-request options (signal, timeoutMs, retry, headers).

Returns Promise<void>

Throws

Example

TypeScript
1await sandbox.files.upload("/srv/index.html", "<h1>Hello</h1>");

download

TypeScript
1async download(path: string, options?: RequestOptions): Promise<ArrayBuffer>

Downloads a file from the sandbox as raw bytes.

Parameters

NameTypeDescription
pathstringAbsolute path inside the sandbox.
options?RequestOptionsPer-request options.

Returns Promise<ArrayBuffer>

Throws

Example

TypeScript
1const buf = await sandbox.files.download("/etc/os-release");
2console.log(new TextDecoder().decode(buf));

At a glance

  • Package: @nodeops-createos/sandbox (npm)
  • Import: import { createClient } from "@nodeops-createos/sandbox"
  • Base URL: https://api.sb.createos.sh — override with CREATEOS_SANDBOX_BASE_URL
  • Auth: API key via the apiKey option or CREATEOS_SANDBOX_API_KEY

See also

  • Sandbox — the parent handle and all other per-sandbox operations.
  • ClientcreateSandbox, getSandbox, listSandboxes, and the sub-API namespaces.
  • Errors — full error class hierarchy.
  • Types — all wire types and option interfaces.

100,000+ Builders. One Workspace.

Get product updates, builder stories, and early access to features that help you ship faster.

CreateOS is a unified intelligent workspace where ideas move seamlessly from concept to live deployment, eliminating context-switching across tools, infrastructure, and workflows with the opportunity to monetize ideas immediately on the CreateOS Marketplace.