Skip to content

Instantly share code, notes, and snippets.

@syusui-s
Last active May 24, 2018 17:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save syusui-s/654dae763466e92c740ec1d549280610 to your computer and use it in GitHub Desktop.
Save syusui-s/654dae763466e92c740ec1d549280610 to your computer and use it in GitHub Desktop.
const fs = require('fs');
const process = require('process');
const child_process = require('child_process');
/* watch current directory */
const x = fs.watch('.', (t, f) => {
console.log(`eventType: ${t}, file: ${f}`)
try {
console.log(child_process.execSync(`ls -lah test.js`, { encoding: 'utf-8' }))
} catch (e) {
// ignore error
}
});
console.log('start watching')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment