Skip to content

Instantly share code, notes, and snippets.

@chuck0523
Created April 3, 2016 08:03
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 chuck0523/b31f359b7e2cedb9f2cbd6930fe22aea to your computer and use it in GitHub Desktop.
Save chuck0523/b31f359b7e2cedb9f2cbd6930fe22aea to your computer and use it in GitHub Desktop.
var watch = require('fs').watch
var exec = require('child_process').exec
var echoFile = (fileName) => {
console.log('execute command...')
exec('less ' + fileName, (error, stdout, stderr) => {
console.log(stdout)
})
}
watch('index.js', (event, fileName) => {
console.log(event + ' to ' + fileName)
echoFile(fileName)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment