MCPcopy Create free account
hub / github.com/nodejs/node / #rescanChildren

Method #rescanChildren

lib/internal/vfs/watcher.js:181–198  ·  view source on GitHub ↗

* Rescans direct children for new entries. * @param {string} dirPath The directory path

(dirPath)

Source from the content-addressed store, hash-verified

179 * @param {string} dirPath The directory path
180 */
181 #rescanChildren(dirPath) {
182 try {
183 const entries = this.#vfs.readdirSync(dirPath);
184 for (const name of entries) {
185 const fullPath = join(dirPath, name);
186 if (!this.#trackedFiles.has(fullPath)) {
187 const stats = this.#getStatsFor(fullPath);
188 this.#trackedFiles.set(fullPath, {
189 stats,
190 relativePath: name,
191 });
192 this.emit('change', 'rename', this.#encodeFilename(name));
193 }
194 }
195 } catch {
196 // Directory might not exist or be readable
197 }
198 }
199
200 /**
201 * Recursively rescans for new entries.

Callers 1

#pollDirectoryMethod · 0.95

Calls 7

#getStatsForMethod · 0.95
#encodeFilenameMethod · 0.95
hasMethod · 0.65
joinFunction · 0.50
readdirSyncMethod · 0.45
setMethod · 0.45
emitMethod · 0.45

Tested by

no test coverage detected