Simple file/directory watcher library with a simple API
Example:
;
With miniwatch you can watch a directory for file changes using the well-known (error, result)
callback pattern. The events are throttled, so you can optimize your event handling for a bunch of simultaneous file changes. All the initial files, currently in the watched directory, are also reported as created. So you don't have to glob
yourself.
More verbose example:
;
API:
miniwatch(options, callback)
with the following options:directory
: string, the directory path you want to watch for changesinclude
: string, glob pattern of files to include (default all)exclude
: string, glob pattern of files to exclude (default none)
miniwatch(directory, callback)
, shorthand if you want to watch all files
Install:
npm install miniwatch