IO::Notification.watch-path($path)
as well as IO::Path.watch
produce a Supply
of IO::Notification::Change
events for a file or directory, depending on what is used as the $path
argument or IO::Path
object.
Here is a small example that prints the first ten FileChanged
-notifications for the current working directory:
my = Promise.new;my = 0;IO::Notification.watch-path().act( ->);await ;
The type of the change is very much dependent both on the platform and on specific system calls that were used to initiate the change. At this point in time you should not rely on the type of change in general, and test your particular situation.
Methods§
method path§
Returns the path of the file that's being watched.
method event§
Returns the type of event: FileChanged
or FileRenamed
.
method IO§
Returns a handle of the file that's being watched.
method gist§
multi method gist(IO::Notification::Change:)
Returns the path and event attributes, separated by semicolon.