miteru
Basic file watcher.
Easy to use
CLI
miteru '**/*.js' -e 'echo $evt: $file'
Module
var miteru = var watcher = miteru watcher
Example
$ miteru '**/*.js' -e 'echo file: $file'events watched: add,changewatching pattern: **/*.js10 files are being watched
CLI STDIN commands
The miteru process listens for line separated STDIN commands ( first match algorithm )
list, files, watched
prints out the files being watched
$ miteru '**/*.js' -e 'echo file: $file'events watched: add,changewatching pattern: **/*.js11 files are being watchedfil /Users/mollie/code/miteru/cli.js /Users/mollie/code/miteru/dist/miteru.js /Users/mollie/code/miteru/sample.js /Users/mollie/code/miteru/src/index.js /Users/mollie/code/miteru/test/bench-readdir.js /Users/mollie/code/miteru/test/samples/animal.js /Users/mollie/code/miteru/test/samples/main.js /Users/mollie/code/miteru/test/test-close.js /Users/mollie/code/miteru/test/test-unwatch.js /Users/mollie/code/miteru/test/test.js /Users/mollie/code/miteru/test/tmp/unwatch.jswatched files: 11
execute
prints out the execute command being used
$ ./cli.js '**/*.js' -e 'echo file: $file'events watched: add,changewatching pattern: **/*.js11 files are being watchedex -e echo file: $file
Install
locally ( project specific, for use with npm scripts )
npm install miteru
globally
npm install -g miteru
Why
Simple file watching that just works ™
as fast and as painless as possible.
Intended for watching files during development qickly and easily to trigger rebuilds etc.
Alternatives
How
Elastic fs.stat polling. Rank orders each file by how often it's changed and sets polling priority accordingly.
Usage
$ miteru --help
Usage: miteru [options] <files>
Options:
-e, --execute <command> Execute a command when a file event occurs.
-i, --init Listen for file init events.
-a, --add Listen for file add events.
-c, --change Listen for file change events.
-u, --unlink Listen for file unlink events.
By default --add and --change events
are listened to if no events are specified.
--limit <milliseconds> Minimum allowed polling interval.
-v, --verbose Verbose output.
--stats Print detailed stats every 1 second.
-V, --version Print miteru version and exit.
-h, --help Print help ( this text ) and exit.
Examples:
miteru -e 'npm run build' "src/**/*.js"
miteru -iacu -e 'echo $evt: $file' "src/**/*.js"
miteru -e 'sshpass -p "giraffe" scp $file user@10.0.0.6:/home/user/app/$file'
NOTE: using sshpass -p "password" will add your password to bash history -- use -f to load password from file.
Test
npm test