inotify

Inotify bindings for OCaml
README

This package contains bindings for Linux's filesystem monitoring
interface, inotify.

Installation

The bindings are available via OPAM:

$ opam install inotify

Alternatively, you can do it manually:

# If you want to lwt_inotify
$ opam install lwt
$ opam install .

Usage

Unix-style interface (findlib package inotify):

let inotify = Inotify.create () in
let watch   = Inotify.add_watch inotify "dir" [Inotify.S_Create] in
print_endline (Inotify.string_of_event (List.hd (Inotify.read inotify)))
(* watch=1 cookie=0 events=CREATE "file" *)

Lwt-style interface (findlib package inotify.lwt):

Lwt_main.run (
  let%lwt inotify = Lwt_inotify.create () in
  let%lwt watch   = Lwt_inotify.add_watch inotify "dir" [Inotify.S_Create] in
  let%lwt event   = Lwt_inotify.read inotify in
  Lwt_io.printl (Inotify.string_of_event event))
  (* watch=1 cookie=0 events=CREATE "file" *)

Note that Lwt-style interface returns events one-by-one, but the Unix-style one returns
them in small batches.

Documentation

The API documentation is available at GitHub pages.

License

LGPL 2.1 with linking exception

Install
Published
08 Nov 2022
Sources
v2.4.1.tar.gz
md5=5bb1c5754d305acf9c1f10611f49aae2
sha512=3e114ee0e8b5b9c7c996df0d2cd8f03e0efdfb9837c1990f98c256868c0e2ad275f91be1adcfbbbcf1bdab801f18e82efa483510d2566e0d12cb303dfc91e4e5
Dependencies
odoc
with-doc
ocaml
>= "4.03"
lwt
with-test
ounit2
with-test & >= "2.0"
fileutils
with-test & >= "0.4.4"
dune
>= "2.9"
Reverse Dependencies
async_inotify
>= "111.17.00"
irmin-watcher
>= "0.4.0"
stone
>= "0.4.0"