Socket
Socket
Sign inDemoInstall

node-ssh

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-ssh - npm Package Compare versions

Comparing version 0.0.8 to 0.1.0

2

lib/build/index.js

@@ -1,1 +0,1 @@

module.exports=function(){function t(t){"use strict";var r=[];if("undefined"==typeof t.username&&r.push(new i("You must specify a valid username")),"undefined"==typeof t.host&&r.push(new i("You must specify a valid host")),"undefined"==typeof t.privateKey?r.push(new i("You must specify path to a privateKey")):n.existsSync(t.privateKey)?n.lstatSync(t.privateKey).isFile()||r.push(new i("The privateKey specified isn't page")):r.push(new i("The privateKey specified doesn't exist")),r.length>0)throw r;t.privateKey=n.readFileSync(t.privateKey),t.port=t.port||22,this.config=t,this.status=!1;try{this.conn=new e}catch(i){throw[i]}}var e=require("ssh2"),n=require("fs"),r=require("bluebird");return t.prototype.connect=function(){"use strict";var t=this;return new r(function(e,n){try{t.conn.on("error",n),t.conn.on("ready",function(){t.status=!0,e()}),t.conn.connect(t.config)}catch(r){n(r)}})},t.prototype.exec=function(t,e){"use strict";var n=this;return e=e||{},new r(function(r,i){return n.status?(e.cwd&&(t="cd "+e.cwd+"; "+t),void n.conn.exec(t,function(t,e){if(t)return i(t);var n={stdout:"",stderr:""};e.on("close",function(){n.stdout=n.stdout.toString(),n.stderr=n.stderr.toString(),r(n)}).on("data",function(t){n.stdout=t}).stderr.on("data",function(t){n.stderr=t})})):i("Not yet connected to server")})},t.prototype.put=function(t,e){"use strict";var i=this;return new r(function(r,o){return n.existsSync(t)?void i.conn.sftp(function(n,s){return n?o(n):void s.fastPut(t,e,{},function(n){return n?void("No such file"===n.message?i.mkdir(e.split("/").slice(0,-1).join("/")).then(function(){i.put(t,e)}):o(n)):r()})}):o("Local File doesn't exist")})},t.prototype.mkdir=function(t){"use strict";return this.exec("mkdir -p "+t)},t}();
module.exports=function(){function t(t){"use strict";var r=[];if("undefined"==typeof t.username&&r.push(new i("You must specify a valid username")),"undefined"==typeof t.host&&r.push(new i("You must specify a valid host")),"undefined"==typeof t.privateKey?r.push(new i("You must specify path to a privateKey")):n.existsSync(t.privateKey)?n.lstatSync(t.privateKey).isFile()||r.push(new i("The privateKey specified isn't page")):r.push(new i("The privateKey specified doesn't exist")),r.length>0)throw r;t.privateKey=n.readFileSync(t.privateKey),t.port=t.port||22,this.config=t,this.status=!1;try{this.conn=new e}catch(i){throw[i]}}var e=require("ssh2"),n=require("fs"),r=require("a-promise");return t.prototype.connect=function(){"use strict";var t=this;return new r(function(e,n){try{t.conn.on("error",n),t.conn.on("ready",function(){t.status=!0,e()}),t.conn.connect(t.config)}catch(r){n(r)}})},t.prototype.exec=function(t,e){"use strict";var n=this;return e=e||{},new r(function(r,i){return n.status?(e.cwd&&(t="cd "+e.cwd+"; "+t),void n.conn.exec(t,function(t,e){if(t)return i(t);var n={stdout:"",stderr:""};e.on("close",function(){n.stdout=n.stdout.toString(),n.stderr=n.stderr.toString(),r(n)}).on("data",function(t){n.stdout=t}).stderr.on("data",function(t){n.stderr=t})})):i("Not yet connected to server")})},t.prototype.put=function(t,e){"use strict";var i=this;return new r(function(r,o){return n.existsSync(t)?void i.conn.sftp(function(n,s){return n?o(n):void s.fastPut(t,e,{},function(n){return n?void("No such file"===n.message?i.mkdir(e.split("/").slice(0,-1).join("/")).then(function(){i.put(t,e).then(r)}):o(n)):r()})}):o("Local File doesn't exist")})},t.prototype.mkdir=function(t){"use strict";return this.exec("mkdir -p "+t)},t}();

@@ -85,3 +85,3 @@ module.exports = (function(){

self.mkdir(remoteFile.split("/").slice(0,-1).join('/')).then(function(){
self.put(localFile,remoteFile);
self.put(localFile,remoteFile).then(resolve);
});

@@ -88,0 +88,0 @@ } else {

{
"name": "node-ssh",
"version": "0.0.8",
"version": "0.1.0",
"description": "SS2 with Promises",

@@ -5,0 +5,0 @@ "main": "./lib/build/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc