hinotify-bytestring: Haskell binding to inotify, using ByteString filepaths

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

This library provides a wrapper to the Linux Kernel's inotify feature, allowing applications to subscribe to notifications when a file is accessed or modified. Filepaths are represented as ByteStrings.


[Skip to Readme]

Properties

Versions 0.3.8.1, 0.3.8.1
Change log CHANGELOG.md
Dependencies base (>=4.5.0.0 && <5), bytestring, containers, directory, unix [details]
License BSD-3-Clause
Author Lennart Kolmodin
Maintainer Julian Ospald <hasufell@posteo.de>
Category System
Home page https://github.com/hasufell/hinotify-bytestring.git
Source repo head: git clone git://github.com/hasufell/hinotify-bytestring.git
Uploaded by maerwald at 2016-05-01T02:15:39Z

Modules

[Index]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Readme for hinotify-bytestring-0.3.8.1

[back to package description]

hinotify-bytestring: inotify for Haskell using ByteString for filepaths

Build Status

About

hinotify-bytestring, a library to inotify which has been part of the Linux kernel since 2.6.13.

inotify provides file system event notification, simply add a watcher to a file or directory and get an event when it is accessed or modified.

This module is named hinotify-bytestring.

See example code in the examples directory, distributed with the source code.

News

hinotify 0.3.7

hinotify 0.3.2

 -removeWatch :: INotify -> WatchDescriptor -> IO ()
 +removeWatch :: WatchDescriptor -> IO ()
 - { isDirecotry :: Bool
 + { isDirectory :: Bool

hinotify 0.3.1

hinotify 0.3

hinotify 0.2

hinotify 0.1 : Initial release

API

The API basically consists of:

initINotify :: IO INotify
addWatch :: INotify
         -> [EventVariety]   -- different events to listen on
         -> ByteString       -- file/directory to watch
         -> (Event -> IO ()) -- event handler
         -> IO WatchDescriptor
removeWatch :: WatchDescriptor -> IO ()

A sample program:

{-# LANGUAGE OverloadedStrings #-}

import System.Posix.Env.ByteString
import System.IO

import System.INotify

main :: IO ()
main = do
  inotify <- initINotify
  print inotify
  home <- getEnvDefault "HOME" "/home"
  wd <- addWatch
          inotify
          [Open,Close,Access,Modify,Move]
          home
          print
  print wd
  putStrLn "Listens to your home directory. Hit enter to terminate."
  getLine
  removeWatch wd

Download

The code is available via the homepage:

git clone https://github.com/hasufell/hinotify-bytestring.git

The API is available online.

I'm most grateful for feedback on the API, and what else you might have to suggest.

Author

Lennart Kolmodin

kolmodin at gmail.com

This software is released under a BSD-style license. See LICENSE for more details.

Copyright © 2007-2012 Lennart Kolmodin