ssh2-sftp-client
Advanced tools
Comparing version 1.0.2 to 1.0.3
{ | ||
"name": "ssh2-sftp-client", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "ssh2 sftp client for node", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -14,4 +14,4 @@ ## SSH2 SFTP Client | ||
port: '8080', | ||
username: 'xx' | ||
passphrase: 'xxx' | ||
username: 'username' | ||
password: '******' | ||
}).then(() => { | ||
@@ -101,2 +101,5 @@ return sftp.list('/pathname'); | ||
#### Connect | ||
connection config you will see [here](https://github.com/mscdex/ssh2#user-content-client-methods) | ||
### FAQ | ||
@@ -109,2 +112,1 @@ | ||
### TODO |
@@ -8,6 +8,3 @@ /** | ||
// client.connect = config; | ||
let SftpClient = function(){ | ||
// this.closed = true; | ||
this.client = new Client(); | ||
@@ -51,3 +48,2 @@ }; | ||
}); | ||
// console.log('new list: ', list, new Date()); | ||
resolve(list); | ||
@@ -173,11 +169,2 @@ }); | ||
// SftpClient.prototype._rmdir = function(sftp, path) { | ||
// sftp.rmdir(path, (err) => { | ||
// if (err) { | ||
// reject(err); | ||
// } | ||
// resolve(); | ||
// }); | ||
// }; | ||
SftpClient.prototype.rmdir = function(path, recursive) { | ||
@@ -191,3 +178,2 @@ recursive = recursive || false; | ||
if (!recursive) { | ||
console.log('single'); | ||
return sftp.rmdir(path, (err) => { | ||
@@ -220,4 +206,2 @@ if (err) { | ||
console.log('the list file name', name, '|', subPath); | ||
if (item.type === 'd') { | ||
@@ -228,3 +212,2 @@ if (name !== '.' || name !== '..') { | ||
} else { | ||
console.log('delete file', subPath); | ||
promise = this.delete(subPath); | ||
@@ -240,3 +223,2 @@ } | ||
} else { | ||
console.log('delete dir' + p); | ||
return sftp.rmdir(p, (err) => { | ||
@@ -246,3 +228,2 @@ if (err) { | ||
} | ||
// resolve(); | ||
}); | ||
@@ -284,3 +265,2 @@ } | ||
sftp.rename(srcPath, remotePath, (err) => { | ||
console.log(err) | ||
if (err) { | ||
@@ -300,11 +280,8 @@ reject(err); | ||
var c = this.client; | ||
console.log('this is connect'); | ||
return new Promise((resolve, reject) => { | ||
this.client.on('ready', () => { | ||
console.log('the ready'); | ||
this.client.sftp((err, sftp) => { | ||
if (err) { | ||
console.log(err, 'sftp reject'); | ||
reject(err); | ||
@@ -316,3 +293,2 @@ } | ||
}).on('error', (err) => { | ||
console.log(err, 'on ready reject') | ||
reject(err); | ||
@@ -326,3 +302,2 @@ }).connect(config); | ||
this.client.end(); | ||
console.log('end connect'); | ||
resolve(); | ||
@@ -329,0 +304,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
110
21237
546