Computer scienceBackendNode.jsCore ConceptsInternal modulesFile system module

Watchers

Review

Report a typo

Nikki wants the watcher to monitor changes every 10 seconds. Is this code correct or does it need some modifications?

const fs = require('node:fs');

fs.watchFile('docs/pic.jpeg', {interval: 10}, (curr, prev) => {
   console.log(`The file was last accessed at ${prev.atime}.`);
});
Select one option from the list
___

Create a free account to access the full topic