UNPKG

self-reload-json

Version:
18 lines (17 loc) 436 B
(() => { const SelfReloadJSON = require('./lib/'); const watchFile = new SelfReloadJSON({ fileName: './test.json', additive: false, delay: 500 }); watchFile.on('updated', () => { console.log('File Updated:', watchFile); setTimeout(() => { watchFile.save(); }, 100); }) watchFile.on('error', (err) => { console.log('Error while refreshing:', err.message || err); }) })();