runSshCommand
function runSshCommand(options: RunSshCommandOptions): Promise<RunSshCommandResult>;Defined in: src/protocols/ssh/runSshCommand.ts:86
Connects, authenticates, runs command on a fresh exec channel, drains
stdout, and disconnects. The TCP socket, transport, auth session, and
channel are all owned by this helper and torn down before it returns.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options | RunSshCommandOptions |
Returns
Section titled “Returns”Promise<RunSshCommandResult>
Example
Section titled “Example”import { runSshCommand } from "@zero-transfer/ssh";
const { stdoutText } = await runSshCommand({ host: "ssh.example.com", auth: { type: "password", username: "deploy", password: process.env.SSH_PASSWORD! }, command: "uname -a",});console.log(stdoutText);