Expand description
§File Update Monitor
file_update_monitor
is a library for monitoring file changes. It provides a simple interface to watch
file changes in directories and execute custom callback functions when file content changes.
§Main Features
- Monitor file changes in specified directories and subdirectories
- Support debouncing to avoid too frequent updates
- Asynchronous handling of file change events
- Customizable logic for handling file changes
§Example
use file_update_monitor::Monitor;
use std::error::Error;
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
// 创建一个监控器实例,监控当前目录,更新间隔为1秒
let monitor = Monitor::new("./", 1000, |path| {
println!("检测到文件变化: {}", path);
Ok(())
});
// 启动监控
monitor.start().await;
Ok(())
}
Structs§
- Monitor
- Main struct for file monitoring