Created
July 2, 2019 03:50
-
-
Save sohelaman/ed6a74faecd3ac49d5f4c557cd2baae0 to your computer and use it in GitHub Desktop.
Revisions
-
sohelaman created this gist
Jul 2, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ #!/usr/bin/env node const fs = require('fs'); const chokidar = require('chokidar'); chokidar .watch('.', { ignoreInitial: true, ignored: /(^|[\/\\])\../ }) .on('all', (event, path) => { console.log(event, path); let logfile = '~/Downloads/changes.log'; let data = Math.floor(Date.now() / 1000) + ' | ' + event + ' | ' + path; fs.writeFile(logfile, data, err => { if (err) console.log(err); console.log("Successfully Written to File."); }); }) .on('ready', () => console.log('Initial scan complete. Ready for changes.'));