@proedge1/filewatcher
v1.0.4
Published
Watch files for changes
Downloads
4
Maintainers
Readme
File watcher
Watch files for changes.
Installation
npm install @proedge1/filewatcher
Usage
import * as WatchFile from '@proedge1/filewatcher';
const Watcher = new WatchFile();
Watcher.on('folder-updated', log => {
fs.copyFileSync(log.file, log.dest);
});
Watcher.on('file-updated', log => {
fs.writeFileSync(log.dest, log.message);
});
Watcher.on('ready', log => {
console.log(log.msg);
});
Watcher.on('error', log => {
console.error(`[ERROR] -> ${log.name} \n`+
`[CAUSE] -> ${log.cause} \n`+
`[STACK] -> ${log.stack}`);
});
Watcher.watchFolder('./users/Perwollnt', './backup/users/Perwollnt');
//Watcher.[...]("Watch this file/directory","Copy changed file here");
Watcher.watchFile('./srv1/config/UserConfig.ts', "./srv2/config/UserConfig/");