Skip to content
Dashboard

Execute command (streaming)

client.computers.exec.create(stringid, ExecCreateParams { command, cwd, env, timeout_seconds } body, RequestOptionsoptions?): ExecCreateResponse { code, data, message, type } | Stream<ExecCreateResponse { code, data, message, type } >
POST/computers/{id}/exec

Execute a shell command with real-time streaming output as NDJSON. Each line is a JSON object with type (stdout/stderr/exit/error).

ParametersExpand Collapse
id: string
body: ExecCreateParams { command, cwd, env, timeout_seconds }
command?: string
cwd?: string
env?: Record<string, string>
timeout_seconds?: number
ReturnsExpand Collapse
ExecCreateResponse { code, data, message, type }
code?: number

for exit

data?: string

for stdout/stderr

message?: string

for error

type?: string

"stdout", "stderr", "exit", "error"

Execute command (streaming)

import Lightcone from '@tzafon/lightcone';

const client = new Lightcone({
  apiKey: process.env['TZAFON_API_KEY'], // This is the default and can be omitted
});

const exec = await client.computers.exec.create('id');

console.log(exec.code);
Returns Examples