{"id":24572197,"url":"https://github.com/dmitryolshansky/dinotify","last_synced_at":"2025-08-18T05:13:34.042Z","repository":{"id":21660759,"uuid":"24981643","full_name":"DmitryOlshansky/dinotify","owner":"DmitryOlshansky","description":"A tiny D library to work with Linux's kernel inotify file events subsystem.","archived":false,"fork":false,"pushed_at":"2024-05-05T06:56:26.000Z","size":67,"stargazers_count":6,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-14T21:35:48.014Z","etag":null,"topics":["d","filesystem-events"],"latest_commit_sha":null,"homepage":"https://code.dlang.org/packages/dinotify","language":"D","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/DmitryOlshansky.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-09T09:08:59.000Z","updated_at":"2025-02-24T05:58:41.000Z","dependencies_parsed_at":"2022-08-17T16:01:22.845Z","dependency_job_id":null,"html_url":"https://github.com/DmitryOlshansky/dinotify","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/DmitryOlshansky/dinotify","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DmitryOlshansky%2Fdinotify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DmitryOlshansky%2Fdinotify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DmitryOlshansky%2Fdinotify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DmitryOlshansky%2Fdinotify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DmitryOlshansky","download_url":"https://codeload.github.com/DmitryOlshansky/dinotify/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DmitryOlshansky%2Fdinotify/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270946068,"owners_count":24672890,"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","status":"online","status_checked_at":"2025-08-18T02:00:08.743Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["d","filesystem-events"],"created_at":"2025-01-23T18:52:20.664Z","updated_at":"2025-08-18T05:13:34.016Z","avatar_url":"https://github.com/DmitryOlshansky.png","language":"D","funding_links":[],"categories":[],"sub_categories":[],"readme":"dinotify\n========\n\n![Build Status](https://github.com/DmitryOlshansky/dinotify/actions/workflows/d.yml/badge.svg)\n\nA tiny D library to work with Linux's kernel inotify file events subsystem.\n\nCompared to other solutions it doesn't try to be cross-platform and\npretend to abstract away inotify-specific quirks.\n\nFor cross-platform library, see [FSWatch](https://github.com/WebFreak001/FSWatch).\n\n## [Documentation](https://dmitryolshansky.github.io/dinotify/dinotify.html)\n\nDocs are pretty bare ATM, since I've never used DDox before. Looks ugly, I'll try BootDDoc theme next.\n\n## Synopsis\n\nLow-level full control version with `iNotify` function to create a inotify watch descriptor. Please read Linux man on inotify, as dinotify uses the same enumerations for masks.\n\n```d\n    import std.process, std.stdio : writeln, writefln;\n\n    auto monitor = iNotify();\n    executeShell(\"rm -rf tmp\");\n    executeShell(\"mkdir tmp\");\n    // literals are zero-terminated\n    monitor.add(\"tmp\".ptr, IN_CREATE | IN_DELETE);\n    ubyte[] data = [1, 2, 3, 4];\n    executeShell(\"touch tmp/killme\");\n    auto events = monitor.read();\n    assert(events[0].mask == IN_CREATE);\n    assert(events[0].name == \"killme\");\n\n    executeShell(\"rm -rf tmp/killme\");\n    events = monitor.read();\n    assert(events[0].mask == IN_DELETE);\n\n    // Note: watched directory doesn't track events in sub-directories\n    executeShell(\"mkdir tmp/some-dir\");\n    executeShell(\"touch tmp/some-dir/victim\");\n    events = monitor.read();\n    assert(events.length == 1);\n    assert(events[0].mask == (IN_ISDIR | IN_CREATE));\n    assert(events[0].name == \"some-dir\");\n\n```\n\nHigh-level wrapper that does recursive registration with `iNotifyTree`. \n\n```d\n    import std.process;\n    import core.thread;\n\n    executeShell(\"rm -rf tmp\");\n    executeShell(\"mkdir -p tmp/dir1/dir11\");\n    executeShell(\"mkdir -p tmp/dir1/dir12\");\n    auto ntree = iNotifyTree(\"tmp/dir1\", IN_CREATE | IN_DELETE);\n    executeShell(\"touch tmp/dir1/dir11/a.tmp\");\n    executeShell(\"touch tmp/dir1/dir12/b.tmp\");\n    executeShell(\"rm -rf tmp/dir1/dir12\");\n    auto evs = ntree.read();\n    assert(evs.length == 4);\n    // a \u0026 b files created\n    assert(evs[0].mask == IN_CREATE \u0026\u0026 evs[0].path == \"tmp/dir1/dir11/a.tmp\");\n    assert(evs[1].mask == IN_CREATE \u0026\u0026 evs[1].path == \"tmp/dir1/dir12/b.tmp\");\n    // b deleted as part of sub-tree\n    assert(evs[2].mask == IN_DELETE \u0026\u0026 evs[2].path == \"tmp/dir1/dir12/b.tmp\");\n    assert(evs[3].mask == (IN_DELETE | IN_ISDIR) \u0026\u0026 evs[3].path == \"tmp/dir1/dir12\");\n    evs = ntree.read(10.msecs);\n    assert(evs.length == 0);\n    auto t = new Thread((){\n        Thread.sleep(1000.msecs);\n        executeShell(\"touch tmp/dir1/dir11/c.tmp\");\n    }).start();\n    evs = ntree.read(10.msecs);\n    t.join();\n    assert(evs.length == 0);\n    evs = ntree.read(10.msecs);\n    assert(evs.length == 1);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmitryolshansky%2Fdinotify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdmitryolshansky%2Fdinotify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmitryolshansky%2Fdinotify/lists"}