`callable`
- `err`: `nil` or `string`
- `filename`: `string`
- `events`: `table`
- `change`: `boolean` or `nil`
- `rename`: `boolean` or `nil`
Start the handle with the given callback, which will watch the
specified path for changes.
Returns: `0` or `fail`
uv.fs_event_stop() *uv.fs_event_stop()*
> method form `fs_event:stop()`
Stop the handle, the callback will no longer be called.
Returns: `0` or `fail`
uv.fs_event_getpath() *uv.fs_event_getpath()*
> method form `fs_event:getpath()`
Get the path being monitored by the handle.
Returns: `string` or `fail`
==============================================================================
`uv_fs_poll_t` — FS Poll handle *luv-fs-poll-handle* *uv_fs_poll_t*
> |uv_handle_t| functions also apply.
FS Poll handles allow the user to monitor a given path for changes. Unlike
|uv_fs_event_t|, fs poll handles use `stat` to detect when a file has changed
so they can work on file systems where fs event handles can't.
uv.new_fs_poll() *uv.new_fs_poll()*
Creates and initializes a new |uv_fs_poll_t|. Returns the Lua
userdata wrapping it.
Returns: `uv_fs_poll_t userdata` or `fail`
uv.fs_poll_start({fs_poll}, {path}, {interval}, {callback}) *uv.fs_poll_start()*
> method form `fs_poll:start(path, interval, callback)`
Parameters:
- `fs_poll`: `uv_fs_poll_t userdata`
- `path`: `string`
- `interval`: `integer`
- `callback`: `callable`
- `err`: `nil` or `string`
- `prev`: `table` or `nil` (see `uv.fs_stat`)
- `curr`: `table` or `nil` (see `uv.fs_stat`)
Check the file at `path` for changes every `interval`
milliseconds.
Note: For maximum portability, use multi-second intervals.
Sub-second intervals will not detect all changes on many file
systems.
Returns: `0` or `fail`
uv.fs_poll_stop() *uv.fs_poll_stop()*
> method form `fs_poll:stop()`
Stop the handle, the callback will no longer be called.
Returns: `0` or `fail`
uv.fs_poll_getpath() *uv.fs_poll_getpath()*
> method form `fs_poll:getpath()`
Get the path being monitored by the handle.
Returns: `string` or `fail`
==============================================================================
FILE SYSTEM OPERATIONS *luv-file-system-operations* *uv_fs_t*
Most file system functions can operate synchronously or asynchronously. When a
synchronous version is called (by omitting a callback), the function will
immediately return the results of the FS call. When an asynchronous version is
called (by providing a callback), the function will immediately return a
`uv_fs_t userdata` and asynchronously execute its callback; if an error is
encountered, the first and only argument passed to the callback will be the
`err` error string; if the operation completes successfully, the first
argument will be `nil` and the remaining arguments will be the results of the
FS call.
Synchronous and asynchronous versions of `readFile` (with naive error
handling) are implemented below as an example:
>lua
local function readFileSync(path)
local fd = assert(uv.fs_open(path, "r", 438))
local stat = assert(uv.fs_fstat(fd))
local data = assert(uv.fs_read(fd, stat.size, 0))
assert(uv.fs_close(fd))