{"id":18004540,"url":"https://github.com/erikzenker/inotify-cpp","last_synced_at":"2025-10-24T20:05:04.878Z","repository":{"id":10690876,"uuid":"12932273","full_name":"erikzenker/inotify-cpp","owner":"erikzenker","description":"A C++ interface for linux inotify","archived":false,"fork":false,"pushed_at":"2023-09-04T05:35:28.000Z","size":170,"stargazers_count":137,"open_issues_count":11,"forks_count":38,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-07T07:42:51.458Z","etag":null,"topics":["c-plus-plus","linux-inotify","wrapper"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/erikzenker.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"erikzenker"}},"created_at":"2013-09-18T19:17:09.000Z","updated_at":"2025-03-20T02:04:12.000Z","dependencies_parsed_at":"2024-10-30T00:25:49.313Z","dependency_job_id":null,"html_url":"https://github.com/erikzenker/inotify-cpp","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erikzenker%2Finotify-cpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erikzenker%2Finotify-cpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erikzenker%2Finotify-cpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erikzenker%2Finotify-cpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/erikzenker","download_url":"https://codeload.github.com/erikzenker/inotify-cpp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252116162,"owners_count":21697323,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c-plus-plus","linux-inotify","wrapper"],"created_at":"2024-10-30T00:14:45.575Z","updated_at":"2025-10-24T20:05:04.860Z","avatar_url":"https://github.com/erikzenker.png","language":"C++","readme":"# Inotify-cpp #\n![Build and Test](https://github.com/erikzenker/inotify-cpp/workflows/Build%20and%20Test/badge.svg) [![codecov](https://codecov.io/gh/erikzenker/inotify-cpp/branch/master/graph/badge.svg)](https://codecov.io/gh/erikzenker/inotify-cpp) [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://paypal.me/erikzenker)\n===========\n\n__Inotify-cpp__ is a C++ wrapper for linux inotify. It lets you watch for\nfilesystem events on your filesystem tree. The following usage example shows\nthe implementation of a simple filesystem event watcher for the commandline.\n\n## Usage ##\n\n  ```c++\n#include \u003cinotify-cpp/NotifierBuilder.h\u003e\n\n#include \u003cfilesystem\u003e\n\n#include \u003ciostream\u003e\n#include \u003cthread\u003e\n#include \u003cchrono\u003e\n\nusing namespace inotify;\n\nint main(int argc, char** argv)\n{\n    if (argc \u003c= 1) {\n        std::cout \u003c\u003c \"Usage: ./inotify_example /path/to/dir\" \u003c\u003c std::endl;\n        exit(0);\n    }\n\n    // Parse the directory to watch\n    std::filesystem::path path(argv[1]);\n\n    // Set the event handler which will be used to process particular events\n    auto handleNotification = [\u0026](Notification notification) {\n        std::cout \u003c\u003c \"Event \" \u003c\u003c notification.event \u003c\u003c \" on \" \u003c\u003c notification.path \u003c\u003c \" at \"\n                  \u003c\u003c notification.time.time_since_epoch().count() \u003c\u003c \" was triggered.\" \u003c\u003c std::endl;\n    };\n\n    // Set the a separate unexpected event handler for all other events. An exception is thrown by\n    // default.\n    auto handleUnexpectedNotification = [](Notification notification) {\n        std::cout \u003c\u003c \"Event \" \u003c\u003c notification.event \u003c\u003c \" on \" \u003c\u003c notification.path \u003c\u003c \" at \"\n                  \u003c\u003c notification.time.time_since_epoch().count()\n                  \u003c\u003c \" was triggered, but was not expected\" \u003c\u003c std::endl;\n    };\n\n    // Set the events to be notified for\n    auto events = { Event::open | Event::is_dir, // some events occur in combinations\n                    Event::access,\n                    Event::create,\n                    Event::modify,\n                    Event::remove,\n                    Event::move };\n\n    // The notifier is configured to watch the parsed path for the defined events. Particular files\n    // or paths can be ignored(once).\n    auto notifier = BuildNotifier()\n                        .watchPathRecursively(path)\n                        .ignoreFileOnce(\"fileIgnoredOnce\")\n                        .ignoreFile(\"fileIgnored\")\n                        .onEvents(events, handleNotification)\n                        .onUnexpectedEvent(handleUnexpectedNotification);\n\n    // The event loop is started in a separate thread context.\n    std::thread thread([\u0026](){ notifier.run(); });\n\n    // Terminate the event loop after 60 seconds\n    std::this_thread::sleep_for(std::chrono::seconds(60));\n    notifier.stop();\n    thread.join();\n    return 0;\n}\n  ```\n  \n## Build and Install Library ##\n```bash\nmkdir build; cd build\ncmake -DCMAKE_INSTALL_PREFIX=/usr ..\ncmake --build .\n\n# run tests\nctest -VV\n\n# install the library\ncmake --build . --target install\n```\n\n## Build Example ##\n```bash\nmkdir build; cd build\ncmake ..\ncmake --build . --target inotify_example\n./example/inotify_example\n```\n\n## Install from Packet ##\n* Arch Linux: `yaourt -S inotify-cpp-git`\n\n## Dependencies ##\n + lib\n   + boost 1.54.0\n   + c++17\n   + linux 2.6.13\n + build\n   + cmake 3.8  \n\n## Licence\nMIT\n\n## Author ##\nWritten by Erik Zenker (erikzenker@hotmail.com)\n\n## Thanks for Contribution ##\n  + [spelcaster](https://github.com/spelcaster)\n","funding_links":["https://github.com/sponsors/erikzenker","https://paypal.me/erikzenker"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferikzenker%2Finotify-cpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ferikzenker%2Finotify-cpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferikzenker%2Finotify-cpp/lists"}