iop
Version:
Ship Docker Anywhere
45 lines (44 loc) • 1.48 kB
TypeScript
import { getSSHCredentials } from "./utils";
export { getSSHCredentials };
export interface SSHClientOptions {
host: string;
port?: number;
username: string;
identity?: string;
privateKey?: string;
password?: string;
passphrase?: string;
agent?: string;
verbose?: boolean;
skipHostKeyVerification?: boolean;
suppressConnectionErrors?: boolean;
}
export declare class SSHClient {
private ssh;
private connectOptions;
readonly host: string;
private verbose;
private suppressConnectionErrors;
private platformCache?;
private constructor();
static create(options: SSHClientOptions): Promise<SSHClient>;
private setVerbose;
private setSuppressConnectionErrors;
connect(): Promise<void>;
exec(command: string): Promise<string>;
private sanitizeErrorOutput;
close(): Promise<void>;
/**
* Detects the platform architecture of the remote server
* @returns Promise<string> Platform string (e.g., "linux/amd64", "linux/arm64")
*/
detectServerPlatform(): Promise<string>;
/**
* Upload a file to the remote server using native rsync or scp command (fastest for large files)
*/
uploadFile(localPath: string, remotePath: string, onProgress?: (transferred: number, total: number) => void): Promise<void>;
/**
* Download a file from the remote server using SFTP
*/
downloadFile(remotePath: string, localPath: string): Promise<void>;
}