+2
-0
@@ -100,5 +100,7 @@ var fs = require('fs'); | ||
| this.__sftp.end(); | ||
| this.__sftp = null; | ||
| } | ||
| if (this.__ssh) { | ||
| this.__ssh.end(); | ||
| this.__ssh = null; | ||
| } | ||
@@ -105,0 +107,0 @@ }; |
+12
-8
@@ -5,5 +5,6 @@ var fs = require('fs'); | ||
| var async = require('async'); | ||
| var client = require('./client'); | ||
| var Client = require('./client').Client; | ||
| var global_client = new Client(); | ||
| function cp2remote(src, dest, callback) { | ||
| function cp2remote(client, src, dest, callback) { | ||
| client.parse(dest); | ||
@@ -31,4 +32,5 @@ | ||
| // never forget to close the session | ||
| client.on('close', function() { | ||
| client.on('close', function closeHandler() { | ||
| callback(err); | ||
| client.removeListener('close', closeHandler); | ||
| }); | ||
@@ -47,4 +49,5 @@ client.close(); | ||
| client.upload(src, client.remote.path, function(err) { | ||
| client.on('close', function() { | ||
| client.on('close', function closeHandler() { | ||
| callback(err); | ||
| client.removeListener('close', closeHandler); | ||
| }); | ||
@@ -77,3 +80,3 @@ client.close(); | ||
| function cp2local(src, dest, callback) { | ||
| function cp2local(client, src, dest, callback) { | ||
| var remote = client.parse(src); | ||
@@ -88,12 +91,13 @@ // only works on single file now | ||
| exports = module.exports = client; | ||
| exports = module.exports = global_client; | ||
| exports.scp = function(src, dest, callback) { | ||
| var client = new Client(); | ||
| client.on('error', callback); | ||
| var parsed = client.parse(src); | ||
| if (parsed.host && parsed.path) { | ||
| cp2local(parsed, dest, callback); | ||
| cp2local(client, parsed, dest, callback); | ||
| } else { | ||
| cp2remote(src, dest, callback); | ||
| cp2remote(client, src, dest, callback); | ||
| } | ||
| }; |
+1
-1
| { | ||
| "name": "scp2", | ||
| "version": "0.2.0", | ||
| "version": "0.2.1", | ||
| "description": "A pure javascript scp program based on ssh2.", | ||
@@ -5,0 +5,0 @@ "author": "Hsiaoming Yang <lepture@me.com>", |
+12
-0
@@ -192,2 +192,14 @@ # scp2 | ||
| **2015-01-09** `0.2.1` | ||
| 1. Bugfix | ||
| **2014-10-30** `0.2.0` | ||
| 1. Fixed the issue with corrupt download when file Size more than 65K | ||
| 2. Raising error on remote file not found | ||
| 3. Fix mode of all files being set to 0755 | ||
| 4. Dependencies upgrade | ||
| **2013-11-07** `0.1.4` ~stable | ||
@@ -194,0 +206,0 @@ |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
21867
2.5%364
1.68%270
4.65%