{"id":19789606,"url":"https://github.com/webfreak001/fswatch","last_synced_at":"2026-03-02T09:34:20.950Z","repository":{"id":48551274,"uuid":"63633369","full_name":"WebFreak001/FSWatch","owner":"WebFreak001","description":"A cross-platform folder \u0026 file watching library using win32, inotify or std.file","archived":false,"fork":false,"pushed_at":"2023-09-07T10:13:01.000Z","size":33,"stargazers_count":34,"open_issues_count":6,"forks_count":8,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-28T14:48:12.858Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"D","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WebFreak001.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2016-07-18T20:04:38.000Z","updated_at":"2024-12-02T12:35:39.000Z","dependencies_parsed_at":"2024-11-12T06:34:12.757Z","dependency_job_id":"dabed548-9e82-4708-9384-cb5a5fc19ba2","html_url":"https://github.com/WebFreak001/FSWatch","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/WebFreak001/FSWatch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebFreak001%2FFSWatch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebFreak001%2FFSWatch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebFreak001%2FFSWatch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebFreak001%2FFSWatch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WebFreak001","download_url":"https://codeload.github.com/WebFreak001/FSWatch/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebFreak001%2FFSWatch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29997213,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-02T01:47:34.672Z","status":"online","status_checked_at":"2026-03-02T02:00:07.342Z","response_time":60,"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":[],"created_at":"2024-11-12T06:34:03.034Z","updated_at":"2026-03-02T09:34:20.894Z","avatar_url":"https://github.com/WebFreak001.png","language":"D","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FSWatch\n\n[![CI](https://github.com/WebFreak001/FSWatch/actions/workflows/test.yml/badge.svg)](https://github.com/WebFreak001/FSWatch/actions/workflows/test.yml) [![Dub version](https://img.shields.io/dub/v/fswatch.svg) ![Dub downloads](https://img.shields.io/dub/dt/fswatch.svg)](https://code.dlang.org/packages/fswatch)\n\nA cross platform library simplifying watching for file changes using a non-blocking interface using the Win32 API, `inotify` or `std.file.dirEntries` as fallback.\n\n## Comparison between implementations\n|Platform|Watching Directory|Watching File|\n|---|---|---|\n|Windows|`ReadDirectoryChangesW` (very fast, accurate)|polling using `std.file.timeLastModified` and `std.file.exists` (fast, not accurate for quick write)|\n|Linux|`inotify` (very fast, accurate)|`inotify` (very fast, accurate)|\n|Other|polling using `std.file.dirEntries` (slow, not accurate)|polling using `std.file.timeLastModified` and `std.file.exists` (fast, not accurate for quick write)|\n\nTo force usage of the `std.file` polling implementation you can just add `version = FSWForcePoll;`\n\nDon't do this unless you have a specific reason as you will lose speed and accuracy!\n\n## Example\n\n```d\nvoid main()\n{\n\t// Initializes a FileWatch instance to watch on `project1/` (first argument) recursively (second argument)\n\tauto watcher = FileWatch(\"project1/\", true);\n\twhile (true)\n\t{\n\t\t// This will fetch all queued events or an empty array if there are none\n\t\tforeach (event; watcher.getEvents())\n\t\t{\n\t\t\t// paths are relative to the watched directory in most cases\n\t\t\tif (event.path == \"dub.json\" || event.path == \"dub.sdl\")\n\t\t\t{\n\t\t\t\tif (event.type == FileChangeEventType.create)\n\t\t\t\t{\n\t\t\t\t\t// dub.json or dub.sdl got created\n\t\t\t\t}\n\t\t\t\telse if (event.type == FileChangeEventType.modify)\n\t\t\t\t{\n\t\t\t\t\t// dub.json or dub.sdl got modified\n\t\t\t\t}\n\t\t\t\telse if (event.type == FileChangeEventType.remove)\n\t\t\t\t{\n\t\t\t\t\t// dub.json or dub.sdl got deleted\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (event.type == FileChangeEventType.rename)\n\t\t\t{\n\t\t\t\t// The file `event.path` has been removed to `event.newPath`\n\t\t\t}\n\t\t\telse if (event.type == FileChangeEventType.createSelf)\n\t\t\t{\n\t\t\t\t// the folder we are watching has been created\n\t\t\t}\n\t\t\telse if (event.type == FileChangeEventType.removeSelf)\n\t\t\t{\n\t\t\t\t// the folder we are watching has been deleted or renamed\n\t\t\t}\n\t\t}\n\t\t// ...\n\t\tmyapp.handleInput();\n\t\tmyapp.update();\n\t\tmyapp.draw();\n\t}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebfreak001%2Ffswatch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebfreak001%2Ffswatch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebfreak001%2Ffswatch/lists"}