put() doesn't check when the file has finished uploading
telmotrooper opened this issue · 3 comments
I uploaded a 17 MB file to my server using put() and the function called the callback function many seconds before the file finished uploading.
The example provided in the documentation goes as follows:
ftp.put(buffer, 'path/to/remote/file.txt', function(hadError) {
if (!hadError)
console.log("File transferred successfully!");
});
I'm guessing the callback function is called as soon as the upload starts, differently than what the example suggests. I couldn't find a way to check if the file has finished uploading in the documentation.
Can you please run your program in debug mode? i.e. DEBUG=jsftp:* node yourprogram.js
. and post the output?
Thanks!
@sergi Hello, I just did what you asked, the account used is for tests. Here's the log: https://pastebin.com/WADTR5L9
As you can see, the message "File uploaded to the FTP server." comes before the server returns "226-File successfully transferred".
That's what the code looks like: https://pastebin.com/riHs4NZA
Thank you for your time.
Somehow it works now even though I didn't even update the dependencies, but you can see in the log that it wasn't working back when I posted it.
I guess we can close the issue for now, if you can't reproduce it. Especially considering it happened back on jsftp 2.0.0 and it's already on 2.1.2.