Skip to content

Instantly share code, notes, and snippets.

@revdan
Created February 6, 2015 11:58
Show Gist options
  • Save revdan/69eb1bf779553b169db0 to your computer and use it in GitHub Desktop.
Save revdan/69eb1bf779553b169db0 to your computer and use it in GitHub Desktop.
node.js folder watcher
const watcher = require('chokidar').watch(process.argv[2], {ignored: /^\./, persistent: true})
watcher
.on('add', function(path) {console.log('✅ ', path) })
.on('change', function(path) {console.log('💃 ', path) })
.on('unlink', function(path) {console.log('❌ ', path) })
.on('error', function(err) {console.error('💩 ', err) })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment