Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,36 @@ have this installed. This will not work with windows machines.
How to use
------------------------------------------------------------------------

Check out the file "sample.js". It should help show you all you need ;)
Here's an example usage.
A better version with node-expect is in betterSample.js

```javascript

var SSHClient = require("NodeSSH");

var ssh=new SSHClient(addresses,user,password);
var cmds=["uptime","logout"];
function close(addr) {
console.log('('+addresses.length+') Disconnected from '+addr);
}

function data(buffer) {
s=buffer.toString();
if (/\$ /.test(s)) {
if (cmd=cmds.shift())
ssh.write(cmd+"\r\n");
else ssh.close();
}
}

function connect() {
console.log('Connected to '+this.address);
this.on('data',data);
}

ssh.on('close',close);


ssh.connect(connect);

```