2.4.0 • Published 8 years ago

yolowatch v2.4.0

Weekly downloads
6
License
ISC
Repository
github
Last release
8 years ago

yolowatch

Watch changes to subdirectories and subfiles within a given directory.

Uses the filewatcher module to fall back on polling the filesystem when ulimit is reached.

npm install yolowatch

Example

var yolowatch = require('yolowatch')

var watcher = yolowatch('/path/to/my/dir', opts)

watcher.on('changed', function (file, data) {
  console.log(file, 'was changed')
  console.log('is a', data.type) //'file', 'directory'
})

watcher.on('deleted', function (file) {
  console.log(file, 'was deleted')
})

watcher.on('added', function (file, data) {
  console.log(file, 'was added')
})

watcher.close() // remove all listeners

Example data in callback (see folder-walker):

{
  basename: 'index.js',
  relname: 'test/index.js',
  root: '/Users/karissa/dev/node_modules/folder-walker',
  filepath: '/Users/karissa/dev/node_modules/folder-walker/test/index.js',
  stat: [fs.Stat Object],
  type: 'file' // or 'directory'
}

Options

  • Second argument, opts, is passed to filewatcher.
  • Ignore files: opts.filter passed to folder-walker.
2.4.0

8 years ago

2.3.0

8 years ago

2.2.0

8 years ago

2.1.0

8 years ago

1.0.0

8 years ago