{"action":"created","issue":{"url":"https://api.github.com/repos/joyent/node/issues/6655","labels_url":"https://api.github.com/repos/joyent/node/issues/6655/labels{/name}","comments_url":"https://api.github.com/repos/joyent/node/issues/6655/comments","events_url":"https://api.github.com/repos/joyent/node/issues/6655/events","html_url":"https://github.com/joyent/node/issues/6655","id":23895924,"number":6655,"title":"Make fs.watch recursive actually useful","user":{"login":"paulmillr","id":574696,"avatar_url":"https://avatars.githubusercontent.com/u/574696?v=3","gravatar_id":"","url":"https://api.github.com/users/paulmillr","html_url":"https://github.com/paulmillr","followers_url":"https://api.github.com/users/paulmillr/followers","following_url":"https://api.github.com/users/paulmillr/following{/other_user}","gists_url":"https://api.github.com/users/paulmillr/gists{/gist_id}","starred_url":"https://api.github.com/users/paulmillr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulmillr/subscriptions","organizations_url":"https://api.github.com/users/paulmillr/orgs","repos_url":"https://api.github.com/users/paulmillr/repos","events_url":"https://api.github.com/users/paulmillr/events{/privacy}","received_events_url":"https://api.github.com/users/paulmillr/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"indutny","id":238531,"avatar_url":"https://avatars.githubusercontent.com/u/238531?v=3","gravatar_id":"","url":"https://api.github.com/users/indutny","html_url":"https://github.com/indutny","followers_url":"https://api.github.com/users/indutny/followers","following_url":"https://api.github.com/users/indutny/following{/other_user}","gists_url":"https://api.github.com/users/indutny/gists{/gist_id}","starred_url":"https://api.github.com/users/indutny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/indutny/subscriptions","organizations_url":"https://api.github.com/users/indutny/orgs","repos_url":"https://api.github.com/users/indutny/repos","events_url":"https://api.github.com/users/indutny/events{/privacy}","received_events_url":"https://api.github.com/users/indutny/received_events","type":"User","site_admin":false},"milestone":null,"comments":11,"created_at":"2013-12-07T00:59:57Z","updated_at":"2015-05-29T06:12:31Z","closed_at":null,"body":"0.11 adds support for recursive fs watcing with fsevents.\r\n\r\nThis is great, except that even with the change `fs.watch` is useless crap as it was before. There are just two events that are triggered randomly: `change` and `rename` (even for deletion / creation)\r\n\r\nCan we make it more useful at least when it's in fsevents mode?\r\n\r\nFSEvents callback should return `flags` (`FSEventStreamEventFlags`) property. Flags are super useful — we can tell all sorts of things by them. Whether it was created, modified, deleted, whether it was a file or dir or a symlink, whether it was renamed or its finder attr was changed. Like this:\r\n\r\n```javascript\r\nfunction getFileType(flags) {\r\n  if (kFSEventStreamEventFlagItemIsFile & flags) return 'file';\r\n  if (kFSEventStreamEventFlagItemIsDir & flags) return 'directory';\r\n  if (kFSEventStreamEventFlagItemIsSymlink & flags) return 'symlink';\r\n}\r\n```\r\n\r\nSo, **tl;dr**: Introduce `flags` integer argument that is returned when watching through `fs.watch`"},"comment":{"url":"https://api.github.com/repos/joyent/node/issues/comments/106702273","html_url":"https://github.com/joyent/node/issues/6655#issuecomment-106702273","issue_url":"https://api.github.com/repos/joyent/node/issues/6655","id":106702273,"user":{"login":"jorangreef","id":413206,"avatar_url":"https://avatars.githubusercontent.com/u/413206?v=3","gravatar_id":"","url":"https://api.github.com/users/jorangreef","html_url":"https://github.com/jorangreef","followers_url":"https://api.github.com/users/jorangreef/followers","following_url":"https://api.github.com/users/jorangreef/following{/other_user}","gists_url":"https://api.github.com/users/jorangreef/gists{/gist_id}","starred_url":"https://api.github.com/users/jorangreef/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jorangreef/subscriptions","organizations_url":"https://api.github.com/users/jorangreef/orgs","repos_url":"https://api.github.com/users/jorangreef/repos","events_url":"https://api.github.com/users/jorangreef/events{/privacy}","received_events_url":"https://api.github.com/users/jorangreef/received_events","type":"User","site_admin":false},"created_at":"2015-05-29T06:12:31Z","updated_at":"2015-05-29T06:12:31Z","body":"@jasnell There is actually a pull request which has been waiting in libuv to add full recursive support to Windows. It needs a few tweaks and review. It would be great if this could be finished.\r\n\r\nRecursive support is especially needed on Windows as the watch locks the watched directory (i.e. it's not possible to setup a tree of watches).\r\n\r\nWith recursive support on Mac and Windows, it will finally be possible to build a much better third party watch module (using a tree of watches for Linux + increasing the system watch limit). Most of the modules currently rely on scanning and this requires keeping the whole watched tree in memory."}}