Is your feature request related to a problem? Please describe.
Currently, when you do fs.watchFile(...) the process will run forever.
Describe the solution you'd like
A possibility to watcher.unref() would be great.
Describe alternatives you've considered
const watchFile = (path, callback, onError) => {
let previousTime = null;
const interval = setInterval(async () => {
try {
const {mtimeMs} = await stat(path);
if (previousTime !== null && mtimeMs !== previousTime) {
callback(mtimeMs, previousTime);
}
previousTime = mtimeMs;
} catch (error) {
clearInterval(interval);
// The error part is off the Node.js API
onError(error);
}
}, 1000 * 60).unref();
};
Edit: seems like the code above is completely unnecessary 🤦♂️
Is your feature request related to a problem? Please describe.
Currently, when you do
fs.watchFile(...)the process will run forever.Describe the solution you'd like
A possibility to
watcher.unref()would be great.Describe alternatives you've considered
Edit: seems like the code above is completely unnecessary 🤦♂️