Wednesday 7 June 2017

How to fire only once on changing directory content with fs.watch?

Is there a way to fire only once on changing directory content with Node.js fs.watch? By changing directory content I mean adding/deleting bunch of files from it.

I was able to do this only with fs.watchFile But node guys recommend to use fs.watch if possible:

Note: fs.watch() is more efficient than fs.watchFile and fs.unwatchFile. fs.watch should be used instead of fs.watchFile and fs.unwatchFile when possible.

https://nodejs.org/docs/latest/api/fs.html#fs_fs_watchfile_filename_options_listener



via Systems Rebooter

No comments:

Post a Comment