GithubHelp home page GithubHelp logo

ocaml-dune / ocaml-inotify Goto Github PK

View Code? Open in Web Editor NEW

This project forked from whitequark/ocaml-inotify

0.0 1.0 0.0 149 KB

OCaml bindings for inotify.

License: Other

OCaml 73.39% C 18.86% Makefile 7.76%

ocaml-inotify's Introduction

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:

$ opam install lwt ounit fileutils
$ ./configure --enable-tests # --enable-lwt
$ make test 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

ocaml-inotify's People

Contributors

aalekseyev avatar avsm avatar drup avatar dsheets avatar gasche avatar j0sh avatar seanmcl avatar whitequark avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.