-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fs: is fs.unwatchFile() available on Windows? #18305
Comments
This works as intended: 'use strict';
const fs = require('fs');
const watcher = fs.watch(__filename, (eventType) => {
console.log(eventType);
watcher.close();
console.log('watcher.close() called');
}); change
watcher.close() called
[exit] |
The listener argument passed to |
To clarify, in your example the |
@richardlau Thank you! This do work as intended: 'use strict';
const fs = require('fs');
const listener = (current, previous) => {
console.log(current.size, previous.size);
fs.unwatchFile(__filename, listener);
console.log('unwatchFile() called');
}
fs.watchFile(__filename, { interval: 1000 }, listener); I was misguided by the listener signature in last descriptions: Is this signature intended? Added here: #13424 |
PR-URL: nodejs#18310 Fixes: nodejs#18305 Refs: nodejs#13424 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Launch it, then change and save several times.
Expected output:
Real output
I cannot find any caveats in
fs
doc about this. Is there any?The text was updated successfully, but these errors were encountered: