I'm currently using a script in nodeJS to monitor a directory (and it's sub directories), and do some function once a file has been placed there. In reality, this would be an FTP, where users upload files, it is processed, then deleted.
Obviously, i'm already seeing some high amount in CPU usage with the script, as it traverses over the directories, waiting for files to be visible. But what worries me is that the longer the script runs, the higher the memory usage (it just keeps rising exponentially). Are there some lightweight ways to monitor a directory for changes?
Thanks!
EDIT: I'm currently using watch-tree which is great, but still has the increasing-memory issue.
Sounds like you want a wrapper around FAM or inotify. Maybe something like node-inotify-plusplus would work for you.
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