{"_id":"watch.io","_rev":"47-c87d927aa1e9b84f7981cc28c0c05352","name":"watch.io","time":{"modified":"2022-06-28T21:58:19.251Z","created":"2013-11-26T11:14:20.358Z","0.1.0":"2013-11-26T11:14:25.981Z","0.1.1":"2013-11-27T05:56:21.743Z","0.1.2":"2013-11-29T09:08:34.185Z","0.1.3":"2013-12-09T03:09:42.155Z","0.1.4":"2014-01-02T11:29:58.147Z","0.1.5":"2014-02-12T04:17:48.469Z","0.1.6":"2014-02-12T04:30:25.165Z","1.0.0":"2014-04-09T11:09:44.629Z","1.0.1":"2014-04-09T11:15:19.868Z","1.0.2":"2014-07-01T09:38:33.145Z","1.0.3":"2014-07-25T07:33:29.660Z","1.0.4":"2014-09-03T06:20:40.131Z","1.0.5":"2015-01-09T06:56:15.754Z","1.0.6":"2015-05-26T06:38:44.634Z","1.0.7":"2016-01-01T02:27:08.189Z"},"maintainers":[{"name":"dj-notyet","email":"dj.notyet@gmail.com"}],"dist-tags":{"latest":"1.0.7"},"description":"An event wrapper for fs.watch(), with support for recursive directories","readme":"# Watch.IO\n\n[![NPM version](https://img.shields.io/npm/v/watch.io.svg?style=flat-square)](https://www.npmjs.org/package/watch.io)\n[![Build status](https://secure.travis-ci.org/DJ-NotYet/watch.io.png?branch=master)](https://travis-ci.org/DJ-NotYet/watch.io)\n\nAn event wrapper for fs.watch(), with support for recursive directories.\n\n\n## Caution\n\nThe `fs.watch()` API is not 100% consistent across platforms,\nand is unavailable and less reliable in some situations.\n\nDue to the behavior of `fs.watch()`, if you want to read the updated file content\nin the event listener, please delay a few milliseconds manually.\n\n\n## Installation\n\n```bash\nnpm install watch.io\n```\n\n\n## Quickstart\n\nThe `WatchIO` object inherits `events.EventEmitter`, so use it in an event-style.\n\n```javascript\nvar WatchIO = require('watch.io'),\n    watcher = new WatchIO()\n;\n\n// Watch a folder recursively\nwatcher.watch('/path/to/folder');\n\n// Listen on file creation\nwatcher.on('create', function ( file, stat ) {\n    // expect( file ).to.be.a('string');\n    // expect( stat ).to.be.a( fs.Stats );\n});\n\n// Listen on file updating\nwatcher.on('update', function ( file, stat ) {\n    // expect( file ).to.be.a('string');\n    // expect( stat ).to.be.a( fs.Stats );\n});\n\n// Listen on file removal\nwatcher.on('remove', function ( file, stat ) {\n    // expect( file ).to.be.a('string');\n    // expect( stat ).to.be.a( fs.Stats );\n});\n\n// Listen on file refreshment\n// The `refresh` event emits when the WatchIO scans a folder\n// which usually occur by calling the `.watch(path)` function\nwatcher.on('refresh', function ( file, stat ) {\n    // expect( file ).to.be.a('string');\n    // expect( stat ).to.be.a( fs.Stats );\n});\n\n// Listen on whatever the file changes\n// the `type` parameter can be any one of: 'create', 'update', 'remove', 'refresh'\nwatcher.on('change', function ( type, file, stat ) {\n    // expect( type ).to.be.a('string');\n    // expect( file ).to.be.a('string');\n    // expect( stat ).to.be.a( fs.Stats );\n});\n\n// Listen on whatever the fs.FSWatcher throws an error\n// the `err` parameter is the same as the one from 'error' event of fs.FSWatcher\nwatcher.on('error', function ( err, file ) {\n    // expect( err ).to.be.an( Error );\n    // expect( file ).to.be.a('string');\n});\n\n// Stop watching the folder/file\nwatcher.close('/path/to/folder');\n```\n\nRemoving event listeners is the same as the way in `events.EventEmitter` of node.js.\n\n```javascript\n// As:\nwatcher.removeAllListeners('create');\nwatcher.removeAllListeners('update');\nwatcher.removeAllListeners('remove');\nwatcher.removeAllListeners('refresh');\nwatcher.removeAllListeners('change');\nwatcher.removeAllListeners('error');\n// Or:\nwatcher.removeAllListeners();\n```\n\n\n## Options\n\nInitialize WatchIO object with config:\n\n```javascript\nvar WatchIO = require('watch.io'),\n    watcher = new WatchIO({\n        delay: 100\n    })\n;\n```\n\nOptions:\n\n* `delay` *number* Delay time(ms) for suppress duplicated notify messages from fs.watch(),\ndefaults to 100(ms), set to 0 to disable it.\n\n\n## Windows-platform Issues\n\nDue to the behavior of the underlying API,\nthere have some issues still suck on Windows platform.\n\n* Removing folders will emit an 'EPERM' error.\n  No solutions so far.\n\n* Creating folders manually on Windows, sometimes emit an uncaught 'EBUSY' error.\n  This can be fixed by setting a delay milliseconds longer than 100ms in the Watch.IO options.\n\nWe strongly recommend to use the Watch.IO in the Linux platform or other UNIX-like things.\nOr you can try\n[chokidar](https://www.npmjs.org/package/chokidar)\nor\n[watch](https://www.npmjs.org/package/watch)\n\n\n## License\n\nThe MIT License (MIT)\n\nCopyright (c) 2009-2016, DJ-NotYet <dj.notyet@gmail.com>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n","versions":{"1.0.1":{"name":"watch.io","description":"An event wrapper for fs.watch(), with support for recursive directories","keywords":["watch.io","fs","watch","recursive","notify"],"version":"1.0.1","author":{"name":"DJ-NotYet","email":"dj.notyet@gmail.com"},"contributors":[],"license":{"type":"Apache License 2.0","url":"http://www.apache.org/licenses/LICENSE-2.0"},"main":"index.js","devDependencies":{"mocha":"*","expect.js":"*","jshint":"*","fs-extra":"~0.8"},"scripts":{"build":"make build","test":"make test"},"repository":{"type":"git","url":"git://github.com/DJ-NotYet/watch.io.git"},"bugs":{"url":"https://github.com/DJ-NotYet/watch.io/issues/new","email":"dj.notyet@gmail.com"},"homepage":"https://github.com/DJ-NotYet/watch.io","_id":"watch.io@1.0.1","dist":{"shasum":"e94bf9ef64430b8d66099b7d474016da1d0e1630","tarball":"https://registry.npmjs.org/watch.io/-/watch.io-1.0.1.tgz","integrity":"sha512-kFJUYtg2KNtZVBRBa2n13nCtMn9KlXm71fKWbxWre90o2NoxhxfksFfUptAW9L6M1+5Vw8ACzEE3fVFgW5WY4w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBXTzXp9ZGRWYv+R0qr+Z0Dbb2cDZU9r0fpVngZkxku0AiEAyWNmN3eqZXuYOp0dJ5jmkAgPzW4TP/aGeJwjUu0A1Hc="}]},"_from":".","_npmVersion":"1.3.24","_npmUser":{"name":"dj-notyet","email":"dj.notyet@gmail.com"},"maintainers":[{"name":"dj-notyet","email":"dj.notyet@gmail.com"}]},"1.0.2":{"name":"watch.io","description":"An event wrapper for fs.watch(), with support for recursive directories","keywords":["watch.io","fs","watch","recursive","notify"],"version":"1.0.2","author":{"name":"DJ-NotYet","email":"dj.notyet@gmail.com"},"contributors":[],"license":{"type":"Apache License 2.0","url":"http://www.apache.org/licenses/LICENSE-2.0"},"main":"index.js","devDependencies":{"mocha":"*","expect.js":"*","jshint":"*","fs-extra":"~0.8"},"scripts":{"test":"make test"},"repository":{"type":"git","url":"git://github.com/DJ-NotYet/watch.io.git"},"bugs":{"url":"https://github.com/DJ-NotYet/watch.io/issues/new","email":"dj.notyet@gmail.com"},"homepage":"https://github.com/DJ-NotYet/watch.io","gitHead":"ca8eb77d170f00136837451ee1339a6104188249","_id":"watch.io@1.0.2","_shasum":"e52efbdb8350f46872d964535b4f7ec2913565af","_from":".","_npmVersion":"1.4.14","_npmUser":{"name":"dj-notyet","email":"dj.notyet@gmail.com"},"maintainers":[{"name":"dj-notyet","email":"dj.notyet@gmail.com"}],"dist":{"shasum":"e52efbdb8350f46872d964535b4f7ec2913565af","tarball":"https://registry.npmjs.org/watch.io/-/watch.io-1.0.2.tgz","integrity":"sha512-7NBuqf1hWYdmdrdy4LBbUE/WPHLkcoy/QoQIPkDkC/WaljP3IeHlwrWAUXOkf3CzJDbRANFehG12DEZSJa03zg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEkxhfRv03AT0rqW3u5YrbiA7ZL27ZpUFVJ4+leTPkx5AiB1eqMq3jSSkPOCDU+0CaqyCOxv71JtR+DB3/1tSunXng=="}]}},"1.0.3":{"name":"watch.io","description":"An event wrapper for fs.watch(), with support for recursive directories","keywords":["watch.io","fs","watch","recursive","notify"],"version":"1.0.3","author":{"name":"DJ-NotYet","email":"dj.notyet@gmail.com"},"contributors":[],"license":{"type":"Apache License 2.0","url":"http://www.apache.org/licenses/LICENSE-2.0"},"main":"index.js","devDependencies":{"mocha":"*","expect.js":"*","jshint":"*","fs-extra":"~0.8"},"scripts":{"test":"make test"},"repository":{"type":"git","url":"git://github.com/DJ-NotYet/watch.io.git"},"bugs":{"url":"https://github.com/DJ-NotYet/watch.io/issues/new","email":"dj.notyet@gmail.com"},"homepage":"https://github.com/DJ-NotYet/watch.io","gitHead":"19bbf811d1f2a06890c3449f95ac30e2d16c2a18","_id":"watch.io@1.0.3","_shasum":"ce0330a0a9235d0d7643855427fafc5c637a532d","_from":".","_npmVersion":"1.4.14","_npmUser":{"name":"dj-notyet","email":"dj.notyet@gmail.com"},"maintainers":[{"name":"dj-notyet","email":"dj.notyet@gmail.com"}],"dist":{"shasum":"ce0330a0a9235d0d7643855427fafc5c637a532d","tarball":"https://registry.npmjs.org/watch.io/-/watch.io-1.0.3.tgz","integrity":"sha512-ODk4JYS7pBxym8AGHnXlP24ePdJ4DdHOXJ1NVeiiqtyTZN6xR0hlZ89JkmVfygJVwqZhc6ym3x/70Wx5RU24TQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDKD88KYnyK+ZT/ggisAO8cfojBIItU7jMJuViY+ntduAIgQS5fm7HGd/Y0JthoeCpJHxNMdSo+yNCMzoeOsSIgw8I="}]}},"1.0.4":{"name":"watch.io","description":"An event wrapper for fs.watch(), with support for recursive directories","keywords":["watch.io","fs","watch","recursive","notify"],"version":"1.0.4","author":{"name":"DJ-NotYet","email":"dj.notyet@gmail.com"},"contributors":[],"license":{"type":"Apache License 2.0","url":"http://www.apache.org/licenses/LICENSE-2.0"},"main":"index.js","devDependencies":{"mocha":"*","expect.js":"*","jshint":"*","fs-extra":"~0.8"},"scripts":{"test":"make test"},"repository":{"type":"git","url":"git://github.com/DJ-NotYet/watch.io.git"},"bugs":{"url":"https://github.com/DJ-NotYet/watch.io/issues/new","email":"dj.notyet@gmail.com"},"homepage":"https://github.com/DJ-NotYet/watch.io","gitHead":"0906ac90cd8dab171ac1037f62b71d957ca8058a","_id":"watch.io@1.0.4","_shasum":"64d77f087c9f5fd9fa93410815d7000dae1a95f9","_from":".","_npmVersion":"1.4.23","_npmUser":{"name":"dj-notyet","email":"dj.notyet@gmail.com"},"maintainers":[{"name":"dj-notyet","email":"dj.notyet@gmail.com"}],"dist":{"shasum":"64d77f087c9f5fd9fa93410815d7000dae1a95f9","tarball":"https://registry.npmjs.org/watch.io/-/watch.io-1.0.4.tgz","integrity":"sha512-5iqB9UyOLnoG9YY49aJB1FaX5ZiFkPMJZ3NybuPAXzvJCBLJsZv94CW3kgWiDXG3psfH0HOowfh5jCIzt8ktIw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCPOvgT/S3DEqB0kQRJxumbrYWZSx+FzZUjoZOeZ/5gHQIga0tj7LkTT1DKDDWAQPEtIzFj8hJtl1bRtpfRKSHNKtA="}]}},"1.0.5":{"name":"watch.io","description":"An event wrapper for fs.watch(), with support for recursive directories","keywords":["watch.io","fs","watch","recursive","notify"],"version":"1.0.5","author":{"name":"DJ-NotYet","email":"dj.notyet@gmail.com"},"contributors":[],"license":{"type":"Apache License 2.0","url":"http://www.apache.org/licenses/LICENSE-2.0"},"main":"index.js","devDependencies":{"mocha":"*","expect.js":"*","jshint":"*","fs-extra":"~0.8"},"scripts":{"test":"make test"},"repository":{"type":"git","url":"git://github.com/DJ-NotYet/watch.io.git"},"bugs":{"url":"https://github.com/DJ-NotYet/watch.io/issues/new","email":"dj.notyet@gmail.com"},"homepage":"https://github.com/DJ-NotYet/watch.io","gitHead":"d8eb0d155aab273f26d1c2e860d93e1110004a28","_id":"watch.io@1.0.5","_shasum":"b29cd26a3f13f32ac4a772fbc6e12acc345d2ed7","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"dj-notyet","email":"dj.notyet@gmail.com"},"maintainers":[{"name":"dj-notyet","email":"dj.notyet@gmail.com"}],"dist":{"shasum":"b29cd26a3f13f32ac4a772fbc6e12acc345d2ed7","tarball":"https://registry.npmjs.org/watch.io/-/watch.io-1.0.5.tgz","integrity":"sha512-KK/QO6/8ixFxUYtI0uDb2fLKxQ7dLxDkpyYLcpg6ABoeIYXw8A4/b2MIzjvAgguUCuJobgHiUsewoD6U+5talw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCa5bP71lR3zpvkP5nRnHapgzLj6hy7SyTxbjsK2Y6AWQIgLSD8aHiFL69yfkQjPsRIsBCQ0/z0z3qA91c5DIKYQkQ="}]}},"1.0.6":{"name":"watch.io","description":"An event wrapper for fs.watch(), with support for recursive directories","keywords":["watch.io","fs","watch","recursive","notify"],"version":"1.0.6","author":{"name":"DJ-NotYet","email":"dj.notyet@gmail.com"},"contributors":[],"license":"MIT","main":"index.js","devDependencies":{"mocha":"*","expect.js":"*","jshint":"*","fs-extra":"*"},"scripts":{"test":"make test"},"repository":{"type":"git","url":"git://github.com/DJ-NotYet/watch.io.git"},"bugs":{"url":"https://github.com/DJ-NotYet/watch.io/issues/new","email":"dj.notyet@gmail.com"},"homepage":"https://github.com/DJ-NotYet/watch.io#readme","gitHead":"285226c5ea7702f436e618f3a475ea1ed8200f20","_id":"watch.io@1.0.6","_shasum":"4c652c61e16c814606b8e8d61df12f92e213bfaf","_from":".","_npmVersion":"2.9.1","_nodeVersion":"0.12.3","_npmUser":{"name":"dj-notyet","email":"dj.notyet@gmail.com"},"dist":{"shasum":"4c652c61e16c814606b8e8d61df12f92e213bfaf","tarball":"https://registry.npmjs.org/watch.io/-/watch.io-1.0.6.tgz","integrity":"sha512-Jp7cm5fgbAjepTB0rDYDGluKW1VcqmOjfPxmIRQAaktXtDKwwOvhLW+JQOZDBqvQjILEvpgwnD+BZsIrhWm4CQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIE8Ct5qMwLjavrrvwPUapDd+mPqdhmTknr4yNE0PjLkbAiAoI7hgJ1SLbB7Tw7gpUp7DVsCZCC/FvBpMjsDjFoDiyA=="}]},"maintainers":[{"name":"dj-notyet","email":"dj.notyet@gmail.com"}]},"1.0.7":{"name":"watch.io","description":"An event wrapper for fs.watch(), with support for recursive directories","keywords":["watch.io","fs","watch","recursive","notify"],"version":"1.0.7","author":{"name":"DJ-NotYet","email":"dj.notyet@gmail.com"},"contributors":[],"license":"MIT","main":"index.js","devDependencies":{"mocha":"*","expect.js":"*","jshint":"*","fs-extra":"*"},"scripts":{"test":"make test"},"repository":{"type":"git","url":"git://github.com/DJ-NotYet/watch.io.git"},"bugs":{"url":"https://github.com/DJ-NotYet/watch.io/issues/new","email":"dj.notyet@gmail.com"},"homepage":"https://github.com/DJ-NotYet/watch.io#readme","gitHead":"4cdab6b28ac96ab5bc927bc43740c63189b2e071","_id":"watch.io@1.0.7","_shasum":"43833b579da092a46158a8ee1aefa82897f3b578","_from":".","_npmVersion":"2.14.9","_nodeVersion":"0.12.9","_npmUser":{"name":"dj-notyet","email":"dj.notyet@gmail.com"},"dist":{"shasum":"43833b579da092a46158a8ee1aefa82897f3b578","tarball":"https://registry.npmjs.org/watch.io/-/watch.io-1.0.7.tgz","integrity":"sha512-0kfPwuv/VoeblUuJeAqlAcrJ6olHWzIjGJNJg3f0NQyWM7atrjIYfIw9Q5Rq+x1cdchkiIR+fT58RE9FJ2vJ9g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDk5pFbMaRa6UUZDHB9ghC33RDyef9xjKjA8bgjkkkl/AiBcZdjc8MO/s33g8lRB66WAfrYYO/uz/uvqFnQi/iqNeQ=="}]},"maintainers":[{"name":"dj-notyet","email":"dj.notyet@gmail.com"}]}},"homepage":"https://github.com/DJ-NotYet/watch.io#readme","keywords":["watch.io","fs","watch","recursive","notify"],"repository":{"type":"git","url":"git://github.com/DJ-NotYet/watch.io.git"},"contributors":[],"author":{"name":"DJ-NotYet","email":"dj.notyet@gmail.com"},"bugs":{"url":"https://github.com/DJ-NotYet/watch.io/issues/new","email":"dj.notyet@gmail.com"},"license":"MIT","readmeFilename":"README.md","users":{"tunnckocore":true,"flozz":true,"duskalbatross":true,"wisecolt":true}}