runConnectionDiagnostics
function runConnectionDiagnostics(options: RunConnectionDiagnosticsOptions): Promise<ConnectionDiagnosticsResult>;Defined in: src/diagnostics/index.ts:127
Connects to a profile, captures capability and listing samples, and returns a redaction-safe report.
Useful for connectivity “ping” pages, smoke tests, and bug reports. Secrets in the profile are redacted via redactConnectionProfile before being returned. The session is always disconnected before the function returns, including when probes throw.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options | RunConnectionDiagnosticsOptions | Diagnostic probe options. |
Returns
Section titled “Returns”Promise<ConnectionDiagnosticsResult>
Diagnostic report including timings and any captured error.
Example
Section titled “Example”import { runConnectionDiagnostics } from "@zero-transfer/sdk";
const report = await runConnectionDiagnostics({ client, profile: { host: "sftp.example.com", provider: "sftp", username: "deploy", ssh: { privateKey: { path: "./keys/id_ed25519" } }, }, listPath: "/uploads",});
if (!report.ok) { console.error("connection failed:", report.error);} else { console.log(`connect=${report.timings.connectMs}ms list=${report.timings.listMs}ms`); console.log(report.sample); // up to 5 entries from /uploads}