All Projects â†’ hannobraun â†’ Inotify

hannobraun / Inotify

Licence: isc
Idiomatic inotify wrapper for the Rust programming language

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Inotify

gevent inotifyx
gevent compatibility for inotifyx
Stars: ✭ 22 (-87.43%)
Mutual labels:  inotify
Gowatch
🚀 gowatch is a command line tool that builds and (re)starts your go project everytime you save a Go or template file.
Stars: ✭ 539 (+208%)
Mutual labels:  inotify
Dfs
A distributed file server framework based on swoole and inotify
Stars: ✭ 112 (-36%)
Mutual labels:  inotify
DirectoryWatcher
Watch changes in directories
Stars: ✭ 70 (-60%)
Mutual labels:  inotify
Fswatch
A cross-platform file change monitor with multiple backends: Apple OS X File System Events, *BSD kqueue, Solaris/Illumos File Events Notification, Linux inotify, Microsoft Windows and a stat()-based backend.
Stars: ✭ 3,974 (+2170.86%)
Mutual labels:  inotify
Gerbera
UPnP Media Server for 2021: Stream your digital media through your home network and consume it on all kinds of UPnP supporting devices 📱💻📺
Stars: ✭ 710 (+305.71%)
Mutual labels:  inotify
fswatch
File/Directory Watcher for Modern C++
Stars: ✭ 56 (-68%)
Mutual labels:  inotify
Minotaur
A pythonic, asynchronous, inotify interface
Stars: ✭ 163 (-6.86%)
Mutual labels:  inotify
Trackma
Open multi-site list manager for Unix-like systems. (ex-wMAL)
Stars: ✭ 490 (+180%)
Mutual labels:  inotify
Go Fsevents
Recursive filesystem event watcher using inotify in golang
Stars: ✭ 107 (-38.86%)
Mutual labels:  inotify
hxinotify
Haxe→C++/Hashlink/Neko bindings to the inotify linux kernel subsystem
Stars: ✭ 21 (-88%)
Mutual labels:  inotify
Watcher
Watcher is a daemon that watches specified files/folders for changes and fires commands in response to those changes. It is similar to incron, however, configuration uses a simpler to read ini file instead of a plain text file. Unlike incron it can also recursively monitor directories. It's also written in Python, making it easier to hack.
Stars: ✭ 127 (-27.43%)
Mutual labels:  inotify
Inotify
📢 JS achieve the browser title flashing, scrolling, voice prompts, Chrome/Safari/FireFox/IE notice. has no dependencies. It not interfere with any JavaScript libraries or frameworks. has a reasonable footprint 5.05kb (gzipped: 1.75kb)
Stars: ✭ 892 (+409.71%)
Mutual labels:  inotify
sftp-gateway
This repository contains a docker image configured to use the SSH File Transfer Protocol (SFTP) to transfer all its files to Cloud Blob Storage Services. This image can be deployed on a Kubernetes cluster with Helm.
Stars: ✭ 18 (-89.71%)
Mutual labels:  inotify
Clsync
file live sync daemon based on inotify/kqueue/bsm (Linux, FreeBSD), written in GNU C
Stars: ✭ 115 (-34.29%)
Mutual labels:  inotify
watcherd
A shell daemon that will listen for directory changes and execute custom commands for each event.
Stars: ✭ 48 (-72.57%)
Mutual labels:  inotify
Onedrived Dev
A Microsoft OneDrive client for Linux, written in Python3.
Stars: ✭ 672 (+284%)
Mutual labels:  inotify
Hupper
in-process file monitor / reloader for reloading your code automatically during development
Stars: ✭ 167 (-4.57%)
Mutual labels:  inotify
Trigger
Run a user-defined command on file changes
Stars: ✭ 163 (-6.86%)
Mutual labels:  inotify
Entr
A utility for running arbitrary commands when files change
Stars: ✭ 976 (+457.71%)
Mutual labels:  inotify

inotify-rs crates.io Documentation Build Status

Idiomatic inotify wrapper for the Rust programming language.

extern crate inotify;


use std::env;

use inotify::{
    EventMask,
    WatchMask,
    Inotify,
};


fn main() {
    let mut inotify = Inotify::init()
        .expect("Failed to initialize inotify");

    let current_dir = env::current_dir()
        .expect("Failed to determine current directory");

    inotify
        .add_watch(
            current_dir,
            WatchMask::MODIFY | WatchMask::CREATE | WatchMask::DELETE,
        )
        .expect("Failed to add inotify watch");

    println!("Watching current directory for activity...");

    let mut buffer = [0u8; 4096];
    loop {
        let events = inotify
            .read_events_blocking(&mut buffer)
            .expect("Failed to read inotify events");

        for event in events {
            if event.mask.contains(EventMask::CREATE) {
                if event.mask.contains(EventMask::ISDIR) {
                    println!("Directory created: {:?}", event.name);
                } else {
                    println!("File created: {:?}", event.name);
                }
            } else if event.mask.contains(EventMask::DELETE) {
                if event.mask.contains(EventMask::ISDIR) {
                    println!("Directory deleted: {:?}", event.name);
                } else {
                    println!("File deleted: {:?}", event.name);
                }
            } else if event.mask.contains(EventMask::MODIFY) {
                if event.mask.contains(EventMask::ISDIR) {
                    println!("Directory modified: {:?}", event.name);
                } else {
                    println!("File modified: {:?}", event.name);
                }
            }
        }
    }
}

Usage

Include it in your Cargo.toml:

[dependencies]
inotify = "0.9"

Please refer to the documentation and the example above, for information on how to use it in your code.

Please note that inotify-rs is a relatively low-level wrapper around the original inotify API. And, of course, it is Linux-specific, just like inotify itself. If you are looking for a higher-level and platform-independent file system notification library, please consider notify.

If you need to access inotify in a way that this wrapper doesn't support, consider using inotify-sys instead.

Documentation

The most important piece of documentation for inotify-rs is the API reference, as it contains a thorough description of the complete API, as well as examples.

Additional examples can be found in the examples directory.

Please also make sure to read the inotify man page. Inotify use can be hard to get right, and this low-level wrapper won't protect you from all mistakes.

License

Copyright (c) Hanno Braun and contributors

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].