1.0.0 • Published 4 years ago

expatr v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

expatr - react on file system events

Dependency Status NPM version Downloads The MIT License

It's a tiny utility which just listen to file system events(like add/update/remove) and run some command once the such event is triggered.

Installation

  1. Install the expatr utility via npm/yarn:
$ yarn global add expatr
# -or-
$ npm i -g expatr

Usage (example)

  1. Run the expatr in any empty directory:
$ expatr --filter=newfile.txt rm newfile.txt
  1. Trigger file system change in another terminal:
$ touch newfile.txt
  1. Make sure that the 'rm newfile.txt' command was executed:
$ cat newfile.txt
cat: can't open 'newfile.txt': No such file or directory

The 'expatr' supports the next options:

-t --timeout - when the timeout is reached, shutdown without the command execution

-p --poll - use operating system(nix/macos) facilities to be notified about file system events

-i --ignore - use simple pattern to ignore some paths

-f --filter - use regex to filter paths which could cause command execution

The rest arguments will be assumed as the command and its arguments. All stdin/stdout/stderr streams is piped from/to the child process. The child process exit code will be forwarded as an exit code of the 'expatr'.

License

MIT License - see the LICENSE for more details.

1.0.0

4 years ago