- Version: v4 – master
- Platform: Windows 7 x64
- Subsystem: fs
- Create a script:
'use strict';
const fs = require('fs');
fs.watchFile(__filename, { interval: 1000 }, (current, previous) => {
console.log(current.size, previous.size);
fs.unwatchFile(__filename, () => { console.log('File unwatched'); });
console.log('unwatchFile() called');
});
-
Launch it, then change and save several times.
-
Expected output:
275 274
unwatchFile() called
File unwatched
[exit]
Real output
275 274
unwatchFile() called
276 275
unwatchFile() called
277 276
unwatchFile() called
[.., no exit]
I cannot find any caveats in fs doc about this. Is there any?
Launch it, then change and save several times.
Expected output:
Real output
I cannot find any caveats in
fsdoc about this. Is there any?