fsevents 2.3.1 → 2.3.3
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +14 -8
- package/fsevents.js +1 -0
- package/fsevents.node +0 -0
- package/package.json +2 -2
package/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# fsevents
|
1
|
+
# fsevents
|
2
2
|
|
3
3
|
Native access to MacOS FSEvents in [Node.js](https://nodejs.org/)
|
4
4
|
|
@@ -9,24 +9,30 @@ to kqueue.
|
|
9
9
|
This is a low-level library. For a cross-platform file watching module that
|
10
10
|
uses fsevents, check out [Chokidar](https://github.com/paulmillr/chokidar).
|
11
11
|
|
12
|
-
##
|
13
|
-
|
14
|
-
Supports only **Node.js v8.16 and higher**.
|
12
|
+
## Usage
|
15
13
|
|
16
14
|
```sh
|
17
15
|
npm install fsevents
|
18
16
|
```
|
19
17
|
|
20
|
-
|
18
|
+
Supports only **Node.js v8.16 and higher**.
|
21
19
|
|
22
20
|
```js
|
23
21
|
const fsevents = require('fsevents');
|
22
|
+
|
23
|
+
// To start observation
|
24
24
|
const stop = fsevents.watch(__dirname, (path, flags, id) => {
|
25
|
-
const info = fsevents.getInfo(path, flags
|
26
|
-
});
|
27
|
-
|
25
|
+
const info = fsevents.getInfo(path, flags);
|
26
|
+
});
|
27
|
+
|
28
|
+
// To end observation
|
29
|
+
stop();
|
28
30
|
```
|
29
31
|
|
32
|
+
> **Important note:** The API behaviour is slightly different from typical JS APIs. The `stop` function **must** be
|
33
|
+
> retrieved and stored somewhere, even if you don't plan to stop the watcher. If you forget it, the garbage collector
|
34
|
+
> will eventually kick in, the watcher will be unregistered, and your callbacks won't be called anymore.
|
35
|
+
|
30
36
|
The callback passed as the second parameter to `.watch` get's called whenever the operating system detects a
|
31
37
|
a change in the file system. It takes three arguments:
|
32
38
|
|
package/fsevents.js
CHANGED
@@ -50,6 +50,7 @@ function getInfo(path, flags) {
|
|
50
50
|
function getFileType(flags) {
|
51
51
|
if (events.ItemIsFile & flags) return "file";
|
52
52
|
if (events.ItemIsDir & flags) return "directory";
|
53
|
+
if (events.MustScanSubDirs & flags) return "directory";
|
53
54
|
if (events.ItemIsSymlink & flags) return "symlink";
|
54
55
|
}
|
55
56
|
function anyIsTrue(obj) {
|
package/fsevents.node
CHANGED
Binary file
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "fsevents",
|
3
|
-
"version": "2.3.
|
3
|
+
"version": "2.3.3",
|
4
4
|
"description": "Native Access to MacOS FSEvents",
|
5
5
|
"main": "fsevents.js",
|
6
6
|
"types": "fsevents.d.ts",
|
@@ -57,6 +57,6 @@
|
|
57
57
|
},
|
58
58
|
"homepage": "https://github.com/fsevents/fsevents",
|
59
59
|
"devDependencies": {
|
60
|
-
"node-gyp": "^
|
60
|
+
"node-gyp": "^9.4.0"
|
61
61
|
}
|
62
62
|
}
|