gaze-collect

1.1.1 • Public • Published

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
})

Readme

Keywords

Package Sidebar

Install

npm i gaze-collect

Weekly Downloads

1

Version

1.1.1

License

BSD

Last publish

Collaborators

  • karissa