blob: a1332e71c4c320b20a8fee2f9eac36f9e16d6db4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
'use strict';
const common = require('../common');
const assert = require('assert');
const path = require('path');
const fs = require('fs');
common.refreshTmpDir();
const filename = path.join(common.tmpDir, 'watched');
fs.writeFileSync(filename, 'quis custodiet ipsos custodes');
fs.watchFile(filename, { interval: 50 }, common.mustCall(function(curr, prev) {
assert.strictEqual(prev.nlink, 1);
assert.strictEqual(curr.nlink, 0);
fs.unwatchFile(filename);
}));
setTimeout(fs.unlinkSync, common.platformTimeout(300), filename);
|