{"id":13805200,"url":"https://github.com/Larpon/vmon","last_synced_at":"2025-05-13T18:33:19.641Z","repository":{"id":140702931,"uuid":"351438686","full_name":"larpon/vmon","owner":"larpon","description":"An asynchronous directory file change watcher module for Windows, macOS and Linux wrapped for V","archived":false,"fork":false,"pushed_at":"2024-10-13T17:16:38.000Z","size":75,"stargazers_count":35,"open_issues_count":0,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-18T21:47:00.740Z","etag":null,"topics":["filewatcher","v","vlang","vlang-module","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/larpon.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-25T13:03:02.000Z","updated_at":"2024-10-13T18:25:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"a2de84cb-7d79-479d-8175-17fec31808ea","html_url":"https://github.com/larpon/vmon","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/larpon%2Fvmon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/larpon%2Fvmon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/larpon%2Fvmon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/larpon%2Fvmon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/larpon","download_url":"https://codeload.github.com/larpon/vmon/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254003512,"owners_count":21997897,"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":["filewatcher","v","vlang","vlang-module","wrapper"],"created_at":"2024-08-04T01:00:58.513Z","updated_at":"2025-05-13T18:33:19.299Z","avatar_url":"https://github.com/larpon.png","language":"C","funding_links":[],"categories":["Libraries"],"sub_categories":["File handling"],"readme":"# vmon\n\nA V module for asynchronously watching for file changes in a directory.\nThe module is essentially a wrapper for [septag/dmon](https://github.com/septag/dmon).\nIt works for Windows, macOS and Linux.\n\nCurrently `vmon` offers a few additional features over the code in `dmon`.\n\n* Automatic shared access to the user data in the callback thread (via `sync.Mutex`)\n* Automatic init/free of memory resources on clean program exits\n\n# Install\n\n```bash\nv install https://github.com/larpon/vmon\n```\n\n# Usage\n\nFor example usage see `examples/watch_and_wait`\n\n```v\nv run ~/.vmodules/vmon/examples/watch_and_wait\n```\n\nTo watch a directory asynchronously for *file* changes simply do:\n```v\nimport os\nimport vmon\n\nfn watch_callback(watch_id vmon.WatchID, action vmon.Action, root_path string, file_path string, old_file_path string, user_data voidptr) {\n\t// ... do stuff here\n}\n\nfn main() {\n\tvmon.watch(os.home_dir(), watch_callback, 0, voidptr(0)) or { panic(err) }\n\t// ... do stuff here, wait or block the main thread, e.g.:\n\ttime.sleep(10 * time.second)\n}\n```\n\nSince the file watching is running in it's own thread remember to block your main thread while watching for changes, otherwise the app will exit immediately.\n\n# Notes\n\nPlease note that [septag/dmon](https://github.com/septag/dmon) is [licensed](https://github.com/septag/dmon#license-bsd-2-clause) under BSD 2-clause\nwhile the V wrapper code is licensed under MIT.\n\nPlease also note that your user need correct file permission access\nto the directories you're trying to watch. So watching a place\nlike `/tmp` on Unix isn't always possible since this is usually owned by root.\nHowever, you're usually allowed to make subdirectories in `/tmp` which can be watched.\n\nAlso please note that currently you won't receive events from changes to *directories* in the\nwatched path since this is not supported in the C project we rely on.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLarpon%2Fvmon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FLarpon%2Fvmon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLarpon%2Fvmon/lists"}