#watching #directory #framework #folder #action #comparison #path

bin+lib foldeye

Framework for watching files and directories

8 releases (stable)

1.0.6 Aug 29, 2022
0.1.0 Aug 29, 2022

#1141 in Filesystem

Download history 20/week @ 2024-06-30 26/week @ 2024-07-21 60/week @ 2024-07-28

86 downloads per month

MIT license

11KB
258 lines

FOLDEYE

A simple rust crate built for watching changes in a folder.

Usage

use foldeye::*;

fn main() -> Result<(), std::io::Error> {
    let path = "./".to_string();
        let directory = Directory::new(&path.clone())?;
        let chron_timing = "1/1 * * * * *".to_string();

        let chron = Chron::new(path.clone(), chron_timing, directory);
        chron.watch_folder(&path, &|comparison| {
            for action in comparison.action {
                match action {
                    ComparisonActionEnum::Inserted(files) => { println!("Inserted: {:?}", files); }
                    ComparisonActionEnum::Removed(files) => { println!("Removed: {:?}", files); }
                    ComparisonActionEnum::Replaced(files) => { println!("Replaced: {:?}", files); }
                }
            }
        })?;
    }

    Ok(())
}

https:://crates.io/crates/foldeye

Dependencies

~9–16MB
~215K SLoC