Safe Haskell | None |
---|
cross-platform file watching.
- data Event
- data WatchManager
- withManager :: (WatchManager -> IO a) -> IO a
- startManager :: IO WatchManager
- stopManager :: WatchManager -> IO ()
- defaultConfig :: WatchConfig
- data WatchConfig
- withManagerConf :: WatchConfig -> (WatchManager -> IO a) -> IO a
- startManagerConf :: WatchConfig -> IO WatchManager
- watchDir :: WatchManager -> FilePath -> ActionPredicate -> Action -> IO ()
- watchDirChan :: WatchManager -> FilePath -> ActionPredicate -> EventChannel -> IO ()
- watchTree :: WatchManager -> FilePath -> ActionPredicate -> Action -> IO ()
- watchTreeChan :: WatchManager -> FilePath -> ActionPredicate -> EventChannel -> IO ()
Documentation
A file event reported by a file watcher. Each event contains the canonical path for the file and a timestamp guaranteed to be after the event occurred (timestamps represent current time when FSEvents receives it from the OS and/or platform-specific Haskell modules).
Starting/Stopping
data WatchManager Source
withManager :: (WatchManager -> IO a) -> IO aSource
Perform an IO action with a WatchManager in place. Tear down the WatchManager after the action is complete.
startManager :: IO WatchManagerSource
Start a file watch manager.
Directories can only be watched when they are managed by a started watch
watch manager.
When finished watching. you must release resources via stopManager
.
It is preferrable if possible to use withManager
to handle this
automatically.
stopManager :: WatchManager -> IO ()Source
Stop a file watch manager. Stopping a watch manager will immediately stop watching for files and free resources.
data WatchConfig Source
Config object, currently used just for debouncing events.
withManagerConf :: WatchConfig -> (WatchManager -> IO a) -> IO aSource
Watching
watchDir :: WatchManager -> FilePath -> ActionPredicate -> Action -> IO ()Source
Watch the immediate contents of a directory by committing an Action for each event. Watching the immediate contents of a directory will only report events associated with files within the specified directory, and not files within its subdirectories. No two events pertaining to the same FilePath will be executed concurrently.
watchDirChan :: WatchManager -> FilePath -> ActionPredicate -> EventChannel -> IO ()Source
Watch the immediate contents of a directory by streaming events to a Chan. Watching the immediate contents of a directory will only report events associated with files within the specified directory, and not files within its subdirectories.
watchTree :: WatchManager -> FilePath -> ActionPredicate -> Action -> IO ()Source
Watch all the contents of a directory by committing an Action for each event. Watching all the contents of a directory will report events associated with files within the specified directory and its subdirectories. No two events pertaining to the same FilePath will be executed concurrently.
watchTreeChan :: WatchManager -> FilePath -> ActionPredicate -> EventChannel -> IO ()Source
Watch all the contents of a directory by streaming events to a Chan. Watching all the contents of a directory will report events associated with files within the specified directory and its subdirectories.