ssh-tunneling
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -59,3 +59,9 @@ import { ConnectConfig as SshConnectConfig } from 'ssh2'; | ||
close: (key?: string | number) => Promise<void>; | ||
/** | ||
* execute multiple commands | ||
* @params an array of commands | ||
* @return an result array of every command | ||
*/ | ||
batchExec: (commands: string[]) => Promise<string[]>; | ||
} | ||
export { logger, SshTunnel }; |
@@ -337,2 +337,13 @@ "use strict"; | ||
}; | ||
/** | ||
* execute multiple commands | ||
* @params an array of commands | ||
* @return an result array of every command | ||
*/ | ||
this.batchExec = async (commands) => { | ||
const divider = '__ssh_tunneling_divider__'; | ||
const command = commands.join(` && echo ${divider} && `); | ||
const res = await this.exec(command); | ||
return res.split(`${divider}\n`); | ||
}; | ||
const { socksServer, ...restConfig } = sshConfig; | ||
@@ -339,0 +350,0 @@ if (socksServer) { |
{ | ||
"private": false, | ||
"name": "ssh-tunneling", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "a ssh-tunneling client for nodejs", | ||
@@ -6,0 +6,0 @@ "keywords": ["ssh tunnel", "ssh tunneling", "ssh proxy", "ssh port foward"], |
27512
557