i m trying to download 4 GB file from SFTP using node js using ssh2-sftp-client module. My main problem is around 40%(not to be exact sometimes 45 also) of file get downloaded after than downloading stops neither an error occurs not any progress is shown in the download.
i have tried on different system using different internet and facing same issue. Kindly help i m badly struck on this issue.
let Client = require('ssh2-sftp-client');
let sftp = new Client();
function DownloadFromSFTP(){
sftp.connect({
host: '127.0.0.1',
port: '8080',
username: 'username',
password: '******'
}).then(() => {
return sftp.list('/');
}).then((data) => {
if(data.length>0){
var remotepath='/'+data.name;
var localpath=="/path/to/local/folder"+data.name;
sftp.fastGet(remotePath, localPath, {
concurrency:640,
Chunksize:32768},function(err){
if(err) throw err
console.log("downloaded successfully")
});
}
}).catch((err) => {
console.log(err, 'catch error');
});
}
if file is not downloaded fully then it should show error or if it is disconnected from sftp how to check is ftp connected or not