FileWatcher

source extra: file-watcher

Watch a location on the filesystem, and fire desired events.

This is a source node, it however does not set a source function. Internally, the node creates event handlers for the desired events to watch, and those handlers write directly on the node inbound queue.

Node type:

FileWatcher

Input:

–

Output:

ObjectPayload

Extra:

file-watcher

$ pip install "juturna-nodes[file-watcher]"

Pattern

Only paths matching pattern, a glob, produce a message. The supported watchdog versions (6 and 7) match it differently:

  • watchdog 7 matches the whole path relative to location, so * and *.wav only match files directly in location;

  • watchdog 6 matches the end of the path, so *.wav also matches files in the subfolders.

With recursive enabled, ** (the default) and **/*.wav include the subfolders with both versions.

License

  • Code: this node is part of juturna-nodes, MIT (its LICENSE file).

  • watchdog: Apache-2.0 (the license of watchdog on PyPI).

Configuration

Default node arguments, as defined in the node config.toml file. Any of them can be overridden in the node configuration of a pipeline.

[arguments]
location = "./"
pattern = "**"
recursive = false
ignore_directories = true
ignore_updates = true
ignore_deletions = true

[meta]

Pipeline usage

{
  "name": "file_watcher",
  "type": "FileWatcher",
  "configuration": {}
}

Reference

class FileWatcher(
location: str,
pattern: str,
recursive: bool,
ignore_directories: bool,
ignore_updates: bool,
ignore_deletions: bool,
**kwargs,
)

Node implementation class