w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
worker process run code of master process

Somehow your watchdog (fs.watch) is triggered three times, maybe because you write three blocks of data? Maybe it would trigger more often when the file becomes bigger? (Maybe WinSCP it truncating the file before writing?)

I assume you want to trigger only when the file is uploaded completely?

Unfortunately you can't catch the message IN_CLOSE_WRITE from inotify(..).

So do something like var old = to; to = setTimeout(function() { clearTimeout(old); /* insert real stuff here */ }, 1000) inside your fs.watch. The function then would fire only once, if the file keeps changing within the 1000 ms...

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.