1.1.1 • Published 9 years ago

gaze-collect v1.1.1

Weekly downloads
2
License
BSD
Repository
github
Last release
9 years ago

gaze-collect

Watches files for you and outputs all the changed files as they change.

NPM

var Collector = require('gaze-collect')
var watcher = Collector(['/path/to/dir', '/another/path/to/watched/dir'])

watcher.on('data', function (data) {
  // data is a list of the contents of each runtime as a JSON object
  // e.g. [
  // {
  //   "filepath": "/path/to/dir/another/file",
  //   "data": {etc..}
  //  }
  // ]
  //
})

watcher.close()

API

Collector(dirs, opts)

Returns a watcher

dirs: the directories to watch

opts

  • takes any options for the Gaze object
  • also includes: read: boolean. whether or not to read contents into the return object valid: function (filepath). returns true if filepath should be included. defauls to true parse: boolean. whether or not to parse file into json

watcher.close()

Closes the watcher -- stops watching the filesystem.

Events

There should be more, but right now it just emits one event -- that's when the kernel spec (kernel.json) has changed.

data

watcher.on('data', function (data) {
  // list of data
})