{"id":23377979,"url":"https://github.com/beyondjs/watchers","last_synced_at":"2025-04-10T19:51:16.996Z","repository":{"id":64126095,"uuid":"572996814","full_name":"beyondjs/watchers","owner":"beyondjs","description":"A file watching utility designed for BeyondJS applications. This package provides efficient file system monitoring capabilities, enabling real-time detection of file changes, additions, and deletions. Ideal for developers working with BeyondJS projects requiring dynamic file observation and event-driven responses to file system modifications.","archived":false,"fork":false,"pushed_at":"2024-12-31T10:11:02.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-21T19:45:04.685Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/beyondjs.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":"2022-12-01T13:34:35.000Z","updated_at":"2024-09-13T23:04:36.000Z","dependencies_parsed_at":"2024-12-21T18:33:55.853Z","dependency_job_id":"2d2f9952-da67-4425-b0d6-7d29f0134192","html_url":"https://github.com/beyondjs/watchers","commit_stats":{"total_commits":3,"total_committers":1,"mean_commits":3.0,"dds":0.0,"last_synced_commit":"e87257ae8e1bd69819539a91c3b00ffa54886a7d"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beyondjs%2Fwatchers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beyondjs%2Fwatchers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beyondjs%2Fwatchers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beyondjs%2Fwatchers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beyondjs","download_url":"https://codeload.github.com/beyondjs/watchers/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248283473,"owners_count":21077852,"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-12-21T18:33:41.527Z","updated_at":"2025-04-10T19:51:16.988Z","avatar_url":"https://github.com/beyondjs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @beyond-js/watchers\n\nA powerful and flexible file watching utility for Node.js applications, designed to work seamlessly with BeyondJS\nprojects.\n\n## Installation\n\n```bash\nnpm install @beyond-js/watchers\n```\n\n## Usage\n\n```javascript\nconst Watcher = require('@beyond-js/watchers');\n\nconst container = {\n\tpath: '/path/to/watch'\n\t// other container properties\n};\n\nconst watcher = new Watcher(container);\n\nwatcher.start().then(() =\u003e {\n\tconsole.log('Watcher started');\n\n\tconst listener = watcher.listeners.create('/path/to/watch', {\n\t\tincludes: ['*.js'],\n\t\texcludes: ['node_modules'],\n\t\textname: ['.js', '.ts']\n\t});\n\n\tlistener.on('change', file =\u003e {\n\t\tconsole.log(`File changed: ${file}`);\n\t});\n});\n\n// Later, when you're done watching\nwatcher.destroy();\n```\n\n## API\n\n### Watcher\n\n-   `constructor(container: object)`: Creates a new watcher instance\n-   `start(): Promise\u003cvoid\u003e`: Starts the watcher\n-   `destroy(): void`: Stops the watcher and cleans up resources\n\n### Listener\n\n-   `create(path: string, filter: object): Listener`: Creates a new listener\n-   `on(event: string, callback: Function): void`: Attaches an event listener\n-   `destroy(): void`: Removes the listener\n\n## Features\n\n-   Efficient file watching using chokidar\n-   Support for multiple watchers and listeners\n-   Configurable file filters (includes, excludes, extensions)\n-   Event-based architecture\n-   Integrated with BeyondJS IPC for cross-process communication\n\n## Implementation Details\n\n-   Uses chokidar for file watching\n-   Implements a client-server architecture for distributed watching\n-   Supports chained exceptions for better error handling\n-   Utilizes Promises for asynchronous operations\n\n## License\n\nMIT © [[BeyondJS](https://beyondjs.com)]\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeyondjs%2Fwatchers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeyondjs%2Fwatchers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeyondjs%2Fwatchers/lists"}