MCPcopy Index your code
hub / github.com/nodejs/node / #statsChanged

Method #statsChanged

lib/internal/vfs/watcher.js:297–317  ·  view source on GitHub ↗

* Checks if stats have changed. * @param {Stats|null} oldStats Previous stats * @param {Stats|null} newStats Current stats * @returns {boolean} True if stats changed

(oldStats, newStats)

Source from the content-addressed store, hash-verified

295 * @returns {boolean} True if stats changed
296 */
297 #statsChanged(oldStats, newStats) {
298 // File created or deleted
299 if ((oldStats === null) !== (newStats === null)) {
300 return true;
301 }
302
303 // Both null - no change
304 if (oldStats === null && newStats === null) {
305 return false;
306 }
307
308 // Compare mtime and size
309 if (oldStats.mtimeMs !== newStats.mtimeMs) {
310 return true;
311 }
312 if (oldStats.size !== newStats.size) {
313 return true;
314 }
315
316 return false;
317 }
318
319 /**
320 * Determines the event type based on stats change.

Callers 2

#pollMethod · 0.95
#pollDirectoryMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected