{"id":13523544,"url":"https://github.com/fsevents/fsevents","last_synced_at":"2025-05-14T04:08:26.496Z","repository":{"id":475380,"uuid":"1402936","full_name":"fsevents/fsevents","owner":"fsevents","description":"Native access to MacOS FSEvents in Node.js","archived":false,"fork":false,"pushed_at":"2024-09-03T21:54:37.000Z","size":227,"stargazers_count":572,"open_issues_count":13,"forks_count":119,"subscribers_count":32,"default_branch":"master","last_synced_at":"2025-05-03T01:53:09.531Z","etag":null,"topics":[],"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/fsevents.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":"2011-02-23T16:41:56.000Z","updated_at":"2025-04-24T11:39:16.000Z","dependencies_parsed_at":"2024-11-27T19:30:53.318Z","dependency_job_id":null,"html_url":"https://github.com/fsevents/fsevents","commit_stats":{"total_commits":231,"total_committers":42,"mean_commits":5.5,"dds":0.7445887445887446,"last_synced_commit":"2db891e51aa0f2975c5eaaf6aa30f13d720a830a"},"previous_names":["strongloop/fsevents"],"tags_count":64,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fsevents%2Ffsevents","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fsevents%2Ffsevents/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fsevents%2Ffsevents/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fsevents%2Ffsevents/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fsevents","download_url":"https://codeload.github.com/fsevents/fsevents/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254069722,"owners_count":22009558,"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":[],"created_at":"2024-08-01T06:01:01.140Z","updated_at":"2025-05-14T04:08:21.448Z","avatar_url":"https://github.com/fsevents.png","language":"C","funding_links":[],"categories":["C","File Watching"],"sub_categories":[],"readme":"# fsevents\n\nNative access to MacOS FSEvents in [Node.js](https://nodejs.org/)\n\nThe FSEvents API in MacOS allows applications to register for notifications of\nchanges to a given directory tree. It is a very fast and lightweight alternative\nto kqueue.\n\nThis is a low-level library. For a cross-platform file watching module that\nuses fsevents, check out [Chokidar](https://github.com/paulmillr/chokidar).\n\n## Usage\n\n```sh\nnpm install fsevents\n```\n\nSupports only **Node.js v8.16 and higher**.\n\n```js\nconst fsevents = require('fsevents');\n\n// To start observation\nconst stop = fsevents.watch(__dirname, (path, flags, id) =\u003e {\n  const info = fsevents.getInfo(path, flags);\n});\n\n// To end observation\nstop();\n```\n\n\u003e **Important note:** The API behaviour is slightly different from typical JS APIs. The `stop` function **must** be\n\u003e retrieved and stored somewhere, even if you don't plan to stop the watcher. If you forget it, the garbage collector\n\u003e will eventually kick in, the watcher will be unregistered, and your callbacks won't be called anymore.\n\nThe callback passed as the second parameter to `.watch` get's called whenever the operating system detects a\na change in the file system. It takes three arguments:\n\n###### `fsevents.watch(dirname: string, (path: string, flags: number, id: string) =\u003e void): () =\u003e Promise\u003cundefined\u003e`\n\n * `path: string` - the item in the filesystem that have been changed\n * `flags: number` - a numeric value describing what the change was\n * `id: string` - an unique-id identifying this specific event\n\n Returns closer callback which when called returns a Promise resolving when the watcher process has been shut down.\n\n###### `fsevents.getInfo(path: string, flags: number, id: string): FsEventInfo`\n\nThe `getInfo` function takes the `path`, `flags` and `id` arguments and converts those parameters into a structure\nthat is easier to digest to determine what the change was.\n\nThe `FsEventsInfo` has the following shape:\n\n```js\n/**\n * @typedef {'created'|'modified'|'deleted'|'moved'|'root-changed'|'cloned'|'unknown'} FsEventsEvent\n * @typedef {'file'|'directory'|'symlink'} FsEventsType\n */\n{\n  \"event\": \"created\", // {FsEventsEvent}\n  \"path\": \"file.txt\",\n  \"type\": \"file\",    // {FsEventsType}\n  \"changes\": {\n    \"inode\": true,   // Had iNode Meta-Information changed\n    \"finder\": false, // Had Finder Meta-Data changed\n    \"access\": false, // Had access permissions changed\n    \"xattrs\": false  // Had xAttributes changed\n  },\n  \"flags\": 0x100000000\n}\n```\n\n## Changelog\n\n- v2.3 supports Apple Silicon ARM CPUs\n- v2 supports node 8.16+ and reduces package size massively\n- v1.2.8 supports node 6+\n- v1.2.7 supports node 4+\n\n## Troubleshooting\n\n- I'm getting `EBADPLATFORM` `Unsupported platform for fsevents` error.\n- It's fine, nothing is broken. fsevents is macos-only. Other platforms are skipped. If you want to hide this warning, report a bug to NPM bugtracker asking them to hide ebadplatform warnings by default.\n\n## License\n\nThe MIT License Copyright (C) 2010-2020 by Philipp Dunkel, Ben Noordhuis, Elan Shankar, Paul Miller — see LICENSE file.\n\nVisit our [GitHub page](https://github.com/fsevents/fsevents) and [NPM Page](https://npmjs.org/package/fsevents)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffsevents%2Ffsevents","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffsevents%2Ffsevents","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffsevents%2Ffsevents/lists"}