Optional
listener: WatchListener<Buffer>v0.5.10
Watch for changes on filename
, where filename
is either a file or a directory, returning an FSWatcher
.
A path to a file or directory. If a URL is provided, it must use the file:
protocol.
Optional
options: BufferEncoding | WatchOptionsEither the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options.
If encoding
is not supplied, the default of 'utf8'
is used.
If persistent
is not supplied, the default of true
is used.
If recursive
is not supplied, the default of false
is used.
Optional
listener: WatchListener<string>Watch for changes on filename
, where filename
is either a file or a directory, returning an FSWatcher
.
A path to a file or directory. If a URL is provided, it must use the file:
protocol.
Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options.
If encoding
is not supplied, the default of 'utf8'
is used.
If persistent
is not supplied, the default of true
is used.
If recursive
is not supplied, the default of false
is used.
Optional
listener: WatchListener<string | Buffer>Watch for changes on filename
, where filename
is either a file or a directory, returning an FSWatcher
.
A path to a file or directory. If a URL is provided, it must use the file:
protocol.
Optional
listener: WatchListener<string>Generated using TypeDoc
Watch for changes on
filename
, wherefilename
is either a file or a directory.The second argument is optional. If
options
is provided as a string, it specifies theencoding
. Otherwiseoptions
should be passed as an object.The listener callback gets two arguments
(eventType, filename)
.eventType
is either'rename'
or'change'
, andfilename
is the name of the file which triggered the event.On most platforms,
'rename'
is emitted whenever a filename appears or disappears in the directory.The listener callback is attached to the
'change'
event fired byfs.FSWatcher
, but it is not the same thing as the'change'
value ofeventType
.If a
signal
is passed, aborting the corresponding AbortController will close the returnedfs.FSWatcher
.