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).
Parameters
id: string
Returns
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);