FedericoCeratto / nim-fswatch

Nim wrapper for the fswatch library
GNU General Public License v3.0
8 stars 1 forks source link
filesystem fswatch libfswatch library nim nim-lang nimlang

libfswatch wrapper

Cross-platform filesystem event monitor for Nim.

Wraps the https://github.com/emcrisostomo/fswatch[libfswatch] library.

image:https://img.shields.io/badge/status-alpha-orange.svg[badge] image:https://img.shields.io/badge/Nim%20version-0.19.0+-green.svg[Nim version] image:https://img.shields.io/github/tag/FedericoCeratto/nim-fswatch.svg[tags] image:https://img.shields.io/badge/License-GPL%20v3-blue.svg[License]

Usage

[source,bash]

sudo apt-get install libfswatch11 nimble install fswatch

[source,nim]

import times, fswatch

var monitor = newMonitor(latency=0.01) monitor.add("my-file-path")

proc callback(eg: EventGroup) = for e in eg: echo e.path, " ", $e.kind, " ", e.time.utc()

monitor.setCallback(callback)

blocks here

monitor.start()

Contributing

Testing and PRs are welcome.