fs: is fs.unwatchFile() available on Windows?

  • Version: v4 – master
  • Platform: Windows 7 x64
  • Subsystem: fs
  1. 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');
});
  1. Launch it, then change and save several times.

  2. 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?