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

Function doWatch

test/parallel/test-fs-watchfile.js:93–103  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

91if (common.isLinux || common.isMacOS || common.isWindows) {
92 const dir = tmpdir.resolve('watch');
93 function doWatch() {
94 const handle = fs.watch(dir, common.mustCall(function(eventType, filename) {
95 clearInterval(interval);
96 handle.close();
97 assert.strictEqual(filename, 'foo.txt');
98 }));
99
100 const interval = setInterval(() => {
101 fs.writeFile(path.join(dir, 'foo.txt'), 'foo', common.mustSucceed());
102 }, 1);
103 }
104
105 fs.mkdir(dir, common.mustSucceed(() => {
106 if (common.isMacOS) {

Calls 6

clearIntervalFunction · 0.85
closeMethod · 0.65
setIntervalFunction · 0.50
watchMethod · 0.45
writeFileMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…