1.0.4 • Published 2 years ago

@proedge1/filewatcher v1.0.4

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

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/");
1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago