MCPcopy Index your code
hub / github.com/nodejs/node / constructor

Method constructor

lib/internal/fs/recursive_watch.js:50–88  ·  view source on GitHub ↗
(options = kEmptyObject)

Source from the content-addressed store, hash-verified

48 #ignoreMatcher = null;
49
50 constructor(options = kEmptyObject) {
51 super();
52
53 assert(typeof options === 'object');
54
55 const { persistent, recursive, signal, encoding, ignore } = options;
56 let { throwIfNoEntry } = options;
57
58 // TODO(anonrig): Add non-recursive support to non-native-watcher for IBMi & AIX support.
59 if (recursive != null) {
60 validateBoolean(recursive, 'options.recursive');
61 }
62
63 if (persistent != null) {
64 validateBoolean(persistent, 'options.persistent');
65 }
66
67 if (signal != null) {
68 validateAbortSignal(signal, 'options.signal');
69 }
70
71 if (throwIfNoEntry != null) {
72 validateBoolean(throwIfNoEntry, 'options.throwIfNoEntry');
73 } else {
74 throwIfNoEntry = true;
75 }
76
77 if (encoding != null) {
78 // This is required since on macOS and Windows it throws ERR_INVALID_ARG_VALUE
79 if (typeof encoding !== 'string') {
80 throw new ERR_INVALID_ARG_VALUE('options.encoding', encoding);
81 }
82 }
83
84 validateIgnoreOption(ignore, 'options.ignore');
85 this.#ignoreMatcher = createIgnoreMatcher(ignore);
86
87 this.#options = { persistent, recursive, signal, encoding, throwIfNoEntry };
88 }
89
90 close() {
91 if (this.#closed) {

Callers

nothing calls this directly

Calls 3

validateAbortSignalFunction · 0.85
createIgnoreMatcherFunction · 0.85
assertFunction · 0.50

Tested by

no test coverage detected