I have a simple node script that looks for a file changes and copies file to the remote server using ssh.
fs.watch(filename,function(curr,prev){
//copy file to the remote server
});
However, since the file i'm watching is uploaded via ftp and for every chunk of data i recieve the file gets changed and the callback gets fired. Is there any way to look for changes only when the complete file has been transfered?
Thanks in advance.
I know this is an old question but for anyone else in the same situation there is now the below module:
https://www.npmjs.com/package/remote-file-watcher
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With