Reputation: 391
I am looking for a stable way to watch for changes on a file using Node.js.
The easiest option fs.watch
is unstable according to the docs. For me it works fine but it is always fired twice per a single change. The file is not really changed twice (on my OSX) and using EventMachine.watch_file the desired event is triggered exactly once per change.
However in gulp any watch-task also works fine: the event is triggered once per change.
So I have two questions: which library/function is used in gulp to watch file and how to use it instead of fs.watch
? I am quite new to Node.js so surfing the sources of gulp didn't help me.
Upvotes: 0
Views: 98