-
Notifications
You must be signed in to change notification settings - Fork 30
An initial option, like chokidar, would be nice #182
Comments
By the way, I've opened the same issue for NSFW: Axosoft/nsfw#60 |
I'm 👍 on having this, although we likely won't need this for Atom itself so I'm less likely to jump on it 😄 The tricky bits here are dealing with race conditions - the filesystem may be modified concurrently with the initial scan, so it's tricky to keep the events we emit consistent. |
I've restarted work on the tree-view watchPath PR and I'm thinking that this would be nice so that the initial watchPath call can give the current directory structure rather than having to do a recursive |
I believe the way Chokidar solves this is by comparing the timestamp of the files/folders with the time at which the watcher is initialized. Items created after the watcher initialization are moved into a separate buffer, which are emitted after the ready event. Even simpler thing to do would be to just emit mtime for the items along with the event. |
Bump. I'd love it if I'm trying to make an in-RAM model of all the files on a hard drive, and an I'd love it if anyone has any ideas for work-arounds. Thank you! |
Prerequisites
Description
chokidar sends
add
events for files and directories viewed on the initial scan. There is an optionignoreInitial
to avoid doing it. It'd be nice to have aninitial
option for@atom/watcher
to do the default behavior of chokidar on this aspect. It's particularly useful on linux where the watcher is already browsing the tree to tell inotify what directories to watch, as it would avoid to have to do it again outside of the watcher (it would costs more syscalls and introduces risk of race conditions).Steps to Reproduce
const w = await watcher.watchPath('/var/log', { initial: true }, events => { /* ... */ })
Expected behavior:
It sends an event for the existing files and directories inside
/var/log
.Actual behavior:
Nothing currently.
Versions
Master
Additional Information
It's a suggestion of an improvement, not a bug report.
The text was updated successfully, but these errors were encountered: