File Watch Trigger Node

The File Watch Trigger will trigger a workflow whenever the Edge Compute device sees file or directory changes on the configured path.

File Watch Trigger

Node Properties

There are two configurable criteria for a File Watch Trigger…

File Path

The file system path to watch. The file system path is a path on the file system of the Edge Compute device where the Gateway Edge Agent is running.

Trigger on…

The types of watch events to trigger on. You can choose to trigger on any combination of adding files, changing files, removing files, adding directories, or removing directories.

Payload

The payload will include information about the event and the triggering file or directory. The stats about the file or directory are only available for creation or modification, not deletion. In the general case, a File Watch workflow payload will look like the following:

{
  "applicationId": <id of the current application>,
  "applicationName": <name of the current application>,
  "data": {
    "event": <event type - "fileAdded" / "fileChanged" / "fileRemoved" / "directoryAdded" / "directoryRemoved">,
    "fullPath": <full name and path to the file or directory that caused the event>,
    "pathParts": {
      "dir": <parent directory path>,
      "base": <full name of the triggering file or directory>,
      "ext": <extension of the triggering file or directory>,
      "name": <name (without extension) of the triggering file or directory>
    },
    "stats": {
      "createdAt": <creation time of the triggering file or directory>,
      "modifiedAt": <last modified time of the triggering file or directory>,
      "size": <size (in bytes) of the triggering file or directory>
    }
  },
  "deviceId": <id of the edge device>,
  "deviceName": <the edge device name>,
  "deviceTags": {<any tags for the edge device>},
  "flowId": <id of the current workflow>,
  "flowName": <name of the current workflow>,
  "flowVersion": <name of the current workflow version>,
  "globals": <object of workflow globals>,
  "isConnectedToLosant": <if the agent is connected to Losant>,
  "agentEnvironment": <object of environment variables>,
  "time": <time of the watch event arrived>,
  "triggerId": <id of the file watch trigger>,
  "triggerType": "fileWatch"
}

Was this page helpful?


Still looking for help? You can also search the Losant Forums or submit your question there.