Created
August 25, 2014 21:36
-
-
Save nullivex/26fd27cfb378d20d7ff8 to your computer and use it in GitHub Desktop.
Revisions
-
nullivex created this gist
Aug 25, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ 'use strict'; var fs = require('fs') var SSH = require('ssh2') var conn = new SSH() conn.on('ready',function(){ conn.exec('cat .ssh/known_hosts',function(err,stream){ stream.setEncoding('utf-8') stream.on('readable',function(){ console.log('stream readable') console.log(stream.read()) }) stream.on('end',function(){ console.log('called end') }) stream.on('close',function(){ console.log('called close') }) stream.on('finish',function(){ console.log('called finish') }) }) }) conn.connect({ host: 'localhost', username: 'root', privateKey: fs.readFileSync('/path/to/key') })