NodeOps
CN

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.
  • Client: createSandbox, getSandbox, listSandboxes, and the sub-API namespaces.
  • Errors: full error class hierarchy.
  • Types: all wire types and option interfaces.

100,000+ 构建者,同一个工作空间。

获取产品更新、构建者故事,以及帮助您更快交付的新功能抢先体验。

NodeOps is the agentic operating system for production AI. CreateOS is its flagship product.