@runnerty/trigger-file-watcher
v3.0.3
Published
Runnerty module: Trigger File Watcher
Downloads
7
Readme
File Watcher Trigger for Runnerty:
It is possible to set up file system path trigger in Runnerty with the help of auto-magically configured filewatchers. Them are defined with the condition property and can be fired through the following actions:
- add: when a file is added.
- change: when a file is changed.
- unlink: when a file is deleted.
- error: when there is an error in the file treatment.
Installation:
Through NPM
npm i @runnerty/trigger-file-watcher
You can also add modules to your project with runnerty-cli
npx runnerty-cli add @runnerty/trigger-file-watcher
This command installs the module in your project, adds example configuration in your config.json
.
If you have installed runnerty-cli globally you can include the module with this command:
rty add @runnerty/trigger-file-watcher
Configuration sample:
Add in config.json:
{
"triggers": [
{
"id": "filewatcher_default",
"type": "@runnerty-trigger-file-watcher"
}
]
}
Plan sample:
Add in plan.json:
{
"triggers": [
{
"id": "filewatcher_default",
"file_name": "/path/myfile.txt",
"condition": "change"
}
]
}
{
"triggers": [
{
"id": "filewatcher_default",
"file_name": "/path/*.jpg",
"condition": "add"
}
]
}
Chain input
This trigger sends to the custom_values of the chain the name of the file watched (file_name). You can make use of this value through the "get values" function:
@GV(file_name)