0.4.0 • Published 10 years ago

watch-interface v0.4.0

Weekly downloads
2
License
MIT
Repository
-
Last release
10 years ago

watch-interface

Recursively gather file meta data starting at a root directory. When files change the meta data gets automatically updated. It is thin wrapper for gaze that takes care of some housekeeping and provides a non-changing interface when we change the watching backend.

Usage

require('watch-interface').on(directory, options, callback)

Starts watching a directory recursively.

  • directory: String, root of what should be watched
  • options: Object with
    • exclude: Array of strings, regular expressions or functions that should match if the particular file should be ignored.
  • callback: gets err object and a gazer

require('watch-interface').onFiles(directory, listOfFiles, options, callback)

Like on but ignore all files except those that are in the list.

gazer.state

  • object with the fields
    • monitor: gazer object from the gaze module
    • lastChange: Date
    • startTime: Date
    • changeList: list of changes accrued since startTime, having the fields:
      • time
      • path
      • type: one of ["creation", "removal", "change"]

gazer.getWatchedFiles(callback)

Retrieve all the files being watched.

  • callback is called with an error object and and array of files (file paths, relative to the base directory being watched)

gazer.getChangesSince(date, callback)

Retrieve what changes happened since a given time.

  • date: Request changes since. Date object or Number specifying a data. If null, returns all changes observed.
  • callback is called with two args: err and [{time,path,type}] with type one of ['removal', 'creation', 'change']

gazer.close(callback)

Stop watching.

  • callback: gets err argument.

License

MIT

0.4.0

10 years ago

0.3.1

10 years ago

0.3.0

10 years ago

0.2.2

10 years ago

0.2.0

10 years ago

0.1.0

11 years ago

0.0.4

12 years ago

0.0.3

12 years ago

0.0.2

12 years ago

0.0.1

12 years ago