Closed EdwardZZZ closed 2 years ago
const fs = require('fs'); fs.watchFile('../testData.json', (curr, prev) => { console.log(`the current mtime is: ${curr.mtime}`); console.log(`the previous mtime was: ${prev.mtime}`); }); fs.watch('../', { encoding: 'utf8', recursive: true }, (eventType, filename) => { console.log(eventType, filename); // 输出: <Buffer ...> });