ssh-as-promised
A pure NodeJS, promise based SSH implementation
Last updated a year ago by pghalliday .
ISC · Repository · Bugs · Original npm · Tarball
$ cnpm install ssh-as-promised 
SYNC missed versions from official npm registry.

ssh-as-promised

A pure NodeJS, promise based SSH library. Depends on the pure node SSH implementation from ssh2.

WORK_IN_PROGRESS: Minimal features implemented as required by ongoing projects

Pull requests welcome.

Usage

npm install ssh-as-promised
const SSH = require('ssh-as-promised');

// options are those for the SSH connection as required
// by the `ssh2` library
const client = new SSH({
  host: 'hostname',
  port: 22,
  username: 'username',
  privateKey: require('fs').readFileSync(process.env['HOME'] + '/.ssh/id_rsa'),
  readyTimeout: 60000
});

client.exec('pwd')
.then(result =>{
  // stdout and stderr will be of type Buffer
  console.log('stdout:\n' + result.stdout);
  console.log('stderr:\n' + result.stderr);
  // exit code
  console.log('code: ' + result.code);
  // signal received or undefined
  console.log('signal: ' + result.signal);
})
.catch(error => {
  console.error(error);
});
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (3)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |