package inotify

  1. Overview
  2. Docs
Inotify bindings for OCaml

Install

Dune Dependency

Authors

Maintainers

Sources

v2.4.tar.gz
md5=6f8c4363528ab10b31f66d18ce095ac1
sha512=d164ab997517008671fdd60ab219cf1539f75928334838f416e31799a2c5198a97eb9d795225c3bb40cc41ac8431022c26b7c8b78ad2d45673158a5e2e554997

Description

Inotify bindings for OCaml

Published: 31 May 2022

README

OCaml Inotify bindings

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

Dependencies (4)

  1. ocaml >= "4.03"
  2. base-bytes
  3. base-unix
  4. dune >= "2.9"

Dev Dependencies (4)

  1. odoc with-doc
  2. lwt with-test
  3. ounit2 with-test & >= "2.0"
  4. fileutils with-test & >= "0.4.4"

Used by (4)

  1. async_inotify >= "111.17.00" & < "v0.16.0"
  2. irmin-watcher >= "0.4.0"
  3. stone >= "0.4.0"
  4. xapi-rrdd

Conflicts

None