fsevents
Advanced tools
Comparing version 2.3.2 to 2.3.3
@@ -53,2 +53,3 @@ /* | ||
if (events.ItemIsDir & flags) return "directory"; | ||
if (events.MustScanSubDirs & flags) return "directory"; | ||
if (events.ItemIsSymlink & flags) return "symlink"; | ||
@@ -55,0 +56,0 @@ } |
{ | ||
"name": "fsevents", | ||
"version": "2.3.2", | ||
"version": "2.3.3", | ||
"description": "Native Access to MacOS FSEvents", | ||
@@ -60,4 +60,4 @@ "main": "fsevents.js", | ||
"devDependencies": { | ||
"node-gyp": "^6.1.0" | ||
"node-gyp": "^9.4.0" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# fsevents [![NPM](https://nodei.co/npm/fsevents.png)](https://nodei.co/npm/fsevents/) | ||
# fsevents | ||
@@ -12,6 +12,4 @@ Native access to MacOS FSEvents in [Node.js](https://nodejs.org/) | ||
## Installation | ||
## Usage | ||
Supports only **Node.js v8.16 and higher**. | ||
```sh | ||
@@ -21,12 +19,20 @@ npm install fsevents | ||
## Usage | ||
Supports only **Node.js v8.16 and higher**. | ||
```js | ||
const fsevents = require('fsevents'); | ||
// To start observation | ||
const stop = fsevents.watch(__dirname, (path, flags, id) => { | ||
const info = fsevents.getInfo(path, flags, id); | ||
}); // To start observation | ||
stop(); // To end observation | ||
const info = fsevents.getInfo(path, flags); | ||
}); | ||
// To end observation | ||
stop(); | ||
``` | ||
> **Important note:** The API behaviour is slightly different from typical JS APIs. The `stop` function **must** be | ||
> retrieved and stored somewhere, even if you don't plan to stop the watcher. If you forget it, the garbage collector | ||
> will eventually kick in, the watcher will be unregistered, and your callbacks won't be called anymore. | ||
The callback passed as the second parameter to `.watch` get's called whenever the operating system detects a | ||
@@ -33,0 +39,0 @@ a change in the file system. It takes three arguments: |
Sorry, the diff of this file is not supported yet
173224
121
90