The ability to receive notifications when a file is added, removed, or updated can be extremely useful. Node's fs module supplies this functionality cross-platform; however, as we'll explore, the functionality across operating systems can be patchy.
In this recipe, we'll write a program that watches a file and outputs some data about the file when it changes. In the There's more... section, we'll explore the limitation of Node's watch functionality along with a third-party module that wraps the core functionality to make it more consistent.