Closed onsightit closed 5 years ago
@onsightit
I will update the documentation for this. Since, every method of ssh object return a Promise object. So, you can directly do the error handling in below manner.
var sftp = ssh.sftp() sftp.readdir("/").then((data) => { console.log(data); //file listing }).catch((err) => { console.log(err) })
No we don't need to call ssh.end(). As per the current documentation , use instead ssh.close() close() - (Promise) - Close the sshconnection and associated tunnels.
@onsightit Updated the documentation
The Documentation shows basic examples, but they should include examples with error handling. Not sure if I should use sftp.on('error', ...
Also, do you still need to call ssh.end()? I do not see it in the examples. Thanks!