once-file-changes

1.0.0 • Public • Published

once-file-changes

stable

Listens for file changes on the specified glob(s) and then fires a callback when something is changed or added. The watcher is then closed and no more callbacks will be fired.

var changes = require('once-file-changes')
 
changes('bundle.js', function(eventType, file) {
  //... do something now that the file has been added or changed
})

eventType is either add or change file is the file that was changed.

Usage

NPM

watcher = changes(glob, callback)

Listens for a single change/add event on glob and then triggers the callback once. Returns the watcher instance which you can close() yourself on timeout if no callback has been received.

glob defaults to wildcard *.

License

MIT, see LICENSE.md for details.

Package Sidebar

Install

npm i once-file-changes

Weekly Downloads

2

Version

1.0.0

License

MIT

Last publish

Collaborators

  • mattdesl