Skip to main content

Simple file-system watcher.

Project description

surveiler

Very simple file-watching utility.

Installation

(coming soon) pip: pip install surveiler

Or just copy the file locally (it's literally 60 lines)

Usage

Two exported functions: make_event_handler, surveil. Signatures (not exactly):

def make_event_handler(**kw: dict[str, Callable[[], None]]) -> Callable[[int], None]: ...
def surveil(directory_name: str, event_handler: Callable[[int], None]) -> Never: ...

Example usage:

event_handler = make_event_handler(on_create=lambda: print('create'), on_modify=lambda: print('modify'))
surveil("testdirec", event_handler)

Check out the constants in the source file to see what event handlers you can add; any one of them can be adapted to a keyword argument to event_handler. Example: IN_MOVE -> on_move.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

surveiler-1.0.0.tar.gz (3.1 kB view hashes)

Uploaded Source

Built Distribution

surveiler-1.0.0-py2.py3-none-any.whl (3.2 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page