fswin32
Version:
The ultimate Node.js module for detailed Windows file system access.
16 lines (13 loc) • 449 B
JavaScript
// src/watch.js
import { watch } from 'fs';
/**
* Watches a file or folder for changes.
* @param {string} path The absolute path of the file or folder to watch.
* @param {Function} callback The callback to execute when a change is detected.
* @returns {fs.FSWatcher} The file system watcher.
*/
export const watchPath = (path, callback) => {
return watch(path, (eventType, filename) => {
callback(eventType, filename);
});
};