ftp.get() not working correctly
alimsahy opened this issue · 7 comments
alimsahy commented
When I try to download the file with the get method, it downloads the file but the file appears to be 0 kb. Is there something I did wrong?
function downloadUpdates()
{
return new Promise((resolve, reject) =>
{
if (filesToUpdate.length > 0)
{
filesToUpdate.forEach(file =>
{
var fileName = file.split('/').pop();
var filePath = file.replace(fileName, '');
var localPath = application.getAppPath() + '/files' + file.replace(ftpPath, '');
console.log(fileName);
console.log('Download Destination: ' + localPath);
console.log('Remote location: ' + file);
ftp.get(file, localPath, (err) =>
{
console.log('Downloading..');
});
});
resolve(true);
}
else
{
reject(false);
}
});
}
thesuhu commented
i have the same issue, download file get 0 KB. it's work fine on Node version 9.0.5
JonathanChaochen commented
same issue after upgrade node from V8.15.1 to V12.11.1 and got errno: 'ECONNRESET'
sdnetwork commented
same issue after upgrade node from v9 to v10
JonathanChaochen commented
So after all. I am using basic-ftp. It works well. recommend to others if have the same problem but still want to use a similar ftp package.
lingaoliu105 commented
Thanks @JonathanChaochen i tried basic-ftp and it works. Don't recommend using this lib. Those weird issues wasted me a lot of time
thesuhu commented
For who want to work with sftp, you can use this package, easy to use: