# Exec ## Create `client.computers.exec.create(stringid, ExecCreateParamsbody, RequestOptionsoptions?): ExecCreateResponse | Stream` **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` - `body: ExecCreateParams` - `command?: string` - `cwd?: string` - `env?: Record` - `timeout_seconds?: number` ### Returns - `ExecCreateResponse` - `code?: number` for exit - `data?: string` for stdout/stderr - `message?: string` for error - `type?: string` "stdout", "stderr", "exit", "error" ### Example ```typescript 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); ``` ## Sync `client.computers.exec.sync(stringid, ExecSyncParamsbody, RequestOptionsoptions?): ExecSyncResponse` **post** `/computers/{id}/exec/sync` Execute a shell command and wait for completion, returning buffered stdout/stderr. ### Parameters - `id: string` - `body: ExecSyncParams` - `command?: string` - `cwd?: string` - `env?: Record` - `timeout_seconds?: number` ### Returns - `ExecSyncResponse` - `exit_code?: number` - `stderr?: string` - `stdout?: string` ### Example ```typescript import Lightcone from '@tzafon/lightcone'; const client = new Lightcone({ apiKey: process.env['TZAFON_API_KEY'], // This is the default and can be omitted }); const response = await client.computers.exec.sync('id'); console.log(response.exit_code); ```