// Sample FTP Code
// ------------------
try {
const Client = require('ssh2').Client;
const conn = new Client();
var ftpConfig = {
host: 'ip',
port: port,
username: 'username',
password: 'password'
, readyTimeout: 5000
}
conn.on('ready', () => {
console.log('Client :: ready');
conn.sftp((err, sftp) => {
if (err) throw err;
sftp.readdir('foo', (err, list) => {
if (err) throw err;
console.dir(list);
conn.end();
});
});
}).connect(ftpConfig);
} catch (error) {
console.log(error, '============ Catch Error ==============');
}
Error
level:"client-timeout"
message:"Timed out while waiting for handshake"
stack:"Error: Timed out while waiting for handshake
at Timeout._onTimeout (C:\Users\rabeeshv\Desktop\Rabeessh\Samples\node_modules\ssh2\lib\client.js:993:23)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7)"