Comparing version 0.2.2 to 0.3.0
@@ -97,2 +97,3 @@ var fs = require('fs'); | ||
}; | ||
Client.prototype.close = function() { | ||
@@ -109,2 +110,3 @@ if (this.__sftp) { | ||
Client.prototype.mkdir = function(dir, attrs, callback) { | ||
@@ -115,4 +117,5 @@ if (_.isFunction(attrs)) { | ||
} | ||
if (attrs) { | ||
attrs.mode = attrs.mode || '0755'; | ||
attrs.mode = getFolderAttr(process.platform, attrs); | ||
} | ||
@@ -309,5 +312,16 @@ | ||
if (process.platform === 'win32') { | ||
filepath = filepath.replace(/\\/g, '/'); | ||
return filepath.replace(/\\/g, '/'); | ||
} | ||
return filepath; | ||
} | ||
function getFolderAttr(platform, attrs) { | ||
var DEFAULT_MODE = '0755'; | ||
if (platform === 'win32') { | ||
return DEFAULT_MODE; | ||
} | ||
if (attrs) { | ||
return attrs.mode || DEFAULT_MODE; | ||
} | ||
} | ||
@@ -84,3 +84,6 @@ var fs = require('fs'); | ||
} | ||
client.download(remote.path, dest, callback); | ||
client.download(remote.path, dest, function () { | ||
client.close(); | ||
callback.apply(this, arguments); | ||
}); | ||
} | ||
@@ -92,4 +95,7 @@ | ||
exports.scp = function(src, dest, callback) { | ||
var client = new Client(); | ||
exports.scp = function(src, dest, client, callback) { | ||
if (typeof client === 'function') { | ||
callback = client; | ||
client = new Client(); | ||
} | ||
client.on('error', callback); | ||
@@ -96,0 +102,0 @@ var parsed = client.parse(src); |
{ | ||
"name": "scp2", | ||
"version": "0.2.2", | ||
"version": "0.3.0", | ||
"description": "A pure javascript scp program based on ssh2.", | ||
@@ -15,3 +15,3 @@ "author": "Hsiaoming Yang <lepture@me.com>", | ||
"dependencies": { | ||
"ssh2": "~0.3.6", | ||
"ssh2": "~0.4.10", | ||
"glob": "~4.0.6", | ||
@@ -18,0 +18,0 @@ "async": "~0.9.0", |
@@ -118,3 +118,4 @@ # scp2 | ||
username: 'admin', | ||
privateKey: '....' | ||
privateKey: '....', | ||
// password: 'password', (accepts password also) | ||
}); | ||
@@ -193,2 +194,12 @@ ``` | ||
**2016-04-18** `0.3.0` | ||
* Retain compatible with old implementations | ||
* Added parameter to scp to allow custom client | ||
* Add password to client object options | ||
* Fix scp from windows client with folder | ||
* Update version of ssh2 to 0.4.10 | ||
* Add pass arguments to callback | ||
* Fix Closes conection when downloading a single file | ||
**2015-06-01** `0.2.2` | ||
@@ -195,0 +206,0 @@ |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
22936
383
287
1
+ Addedasn1@0.2.6(transitive)
+ Addedreadable-stream@1.0.34(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedssh2@0.4.15(transitive)
+ Addedssh2-streams@0.0.23(transitive)
- Removedasn1@0.2.1(transitive)
- Removedreadable-stream@1.0.27-1(transitive)
- Removedssh2@0.3.6(transitive)
Updatedssh2@~0.4.10