sequest (GitHub: mikeal/sequest, License: MIT) by Mikeal Rogers is a simplified interface to the ssh2 (GitHub: mscdex/ssh2, License: MIT) that was featured earlier. It provides a simplified approach on top of the stream based interface.


For example, each command will complete before the next is sent to the server. If any command returns a non-zero exit code sequest will emit an error which effectively ends the stream and the processing of subsequent commands. This allows you to use sequest in a more serial fashion and not have to worry about handling all the pesky stream events. sequest brings in shortcuts to execute a command as well as put and get files remote files.

npm install sequest


By default sequest will use your local ssh-agent to authenticate to remote hosts which should make it unnecessary to enter username, password or private key information. So at the bare minimum, sequest code looks like this:

var sequest = require('sequest');

sequest('root@', 'ls', function (err, stdout) {
  if (err) throw err;

My fully functional example on runnable looks like this:

var sequest = require('sequest');
var fs = require('fs');

var opts = {
  command: 'ls -la', 
  privateKey: fs.readFileSync('/root/.ssh/id_rsa')

sequest('test_user@', opts, function (err, stdout) {
  if (err) throw err;

What Else?

Checkout the runnable example and github example repository.

Post navigation


Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *