jsftp icon indicating copy to clipboard operation
jsftp copied to clipboard

ftp.get() not working correctly

Open alimsahy opened this issue 6 years ago • 7 comments

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);
                }
            });
        }

Result: image

alimsahy avatar Aug 12 '19 21:08 alimsahy

i have the same issue, download file get 0 KB. it's work fine on Node version 9.0.5

thesuhu avatar Sep 05 '19 13:09 thesuhu

same issue after upgrade node from V8.15.1 to V12.11.1 and got errno: 'ECONNRESET'

JonathanChaochen avatar Oct 14 '19 03:10 JonathanChaochen

same issue after upgrade node from v9 to v10

sdnetwork avatar Oct 15 '19 18:10 sdnetwork

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.

JonathanChaochen avatar Oct 16 '19 20:10 JonathanChaochen

Any update on this issue @sergi?

sanjitdev avatar Mar 12 '20 10:03 sanjitdev

Thanks @JonathanChaochen i tried basic-ftp and it works. Don't recommend using this lib. Those weird issues wasted me a lot of time

lingaoliu105 avatar Mar 24 '23 08:03 lingaoliu105

For who want to work with sftp, you can use this package, easy to use:

https://www.npmjs.com/package/mysftp

thesuhu avatar Mar 25 '23 05:03 thesuhu