Z-IO-0.6.4.0: Simple and high performance IO toolkit for Haskell
Copyright(c) Dong Han 2017-2020
LicenseBSD
Maintainerwinterland1989@gmail.com
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Z.IO.FileSystem.Watch

Description

This module provides fs watcher based on libuv's fs_event, we also maintain watch list if target OS doesn't support recursive watch(Linux's inotify).

-- start watching threads, cleanup watching threads automatically when finished.
withResource (initWatchDirs ["fold_to_be_watch"] True) $  srcf -> do
    -- dup a file event source
    src <- srcf
    -- print event to stdout
    runBIO $ src >|> sinkToIO printStd
Synopsis

Documentation

data FileEvent Source #

File event with path info.

Instances

Instances details
Eq FileEvent Source # 
Instance details

Defined in Z.IO.FileSystem.Watch

Ord FileEvent Source # 
Instance details

Defined in Z.IO.FileSystem.Watch

Read FileEvent Source # 
Instance details

Defined in Z.IO.FileSystem.Watch

Show FileEvent Source # 
Instance details

Defined in Z.IO.FileSystem.Watch

Generic FileEvent Source # 
Instance details

Defined in Z.IO.FileSystem.Watch

Associated Types

type Rep FileEvent :: Type -> Type #

JSON FileEvent Source # 
Instance details

Defined in Z.IO.FileSystem.Watch

Print FileEvent Source # 
Instance details

Defined in Z.IO.FileSystem.Watch

Methods

toUTF8BuilderP :: Int -> FileEvent -> Builder () #

type Rep FileEvent Source # 
Instance details

Defined in Z.IO.FileSystem.Watch

watchDirs Source #

Arguments

:: [CBytes]

Directories to be watched

-> Bool

recursively watch?

-> (FileEvent -> IO ())

Callback function to handle FileEvent

-> IO () 

Watching a list of given directories.

initWatchDirs Source #

Arguments

:: [CBytes]

watching list

-> Bool

recursively watch?

-> Resource (IO (Source FileEvent)) 

Start watching a list of given directories, stream version.