Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/federicoceratto/nim-fswatch

Nim wrapper for the fswatch library
https://github.com/federicoceratto/nim-fswatch

filesystem fswatch libfswatch library nim nim-lang nimlang

Last synced: 27 days ago
JSON representation

Nim wrapper for the fswatch library

Awesome Lists containing this project

README

        

## 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.