Import std.io.watcher
std.io.watcher
std.io's file watcher: what happens to a file, or to what's in a folder, as the OS tells libuv, which a FileWatcher queues for the program to take in turn, waiting for it, awaiting it, or not.
std/io/watcher.fb
Types
FileEventKind
enum
Public Enum FileEventKind
What happened at a path, which a watcher tells by the names it knows are there, since OSes call these differently.
-
Something came there, as the new name of a rename does.
-
It changed, as a file that another is renamed over does.
-
It went, as the old name of a rename does.
FileEvent
struct
Public Struct FileEvent
What happened, and where.
-
What happened.
-
The file or folder it happened to.
FileWatcher
class
Public Class FileWatcher
Watches a file, or what's in a folder, but not the folders in it, from when it's made until it's closed or its last reference goes. An OS can tell of one change more than once, as when a write comes in parts, and of a change it makes itself, as of a folder's times. A watched file or folder that's removed may go unwatched on some OSes, even once it's back.
-
The file or folder it watches.
-
Starts watching what's at the
path, which has to be there. -
The next event, waiting for it, or Null once it's closed. Nothing else runs on this thread meanwhile, so one that nothing comes to waits forever.
-
The next event if one's come, or Null.
-
Next's Async twin, which waits on the main thread instead of blocking it.
-
Stops watching, dropping the events not taken yet, so what waits for one, and each later Next, gets Null. A second Close does nothing.
Report an issue with this page or with FutureBlitz on GitHub.