Giter VIP home page Giter VIP logo

watchr's Introduction

Watchr

Watchr provides a better and normalised API between Node's 0.4 watchFile and 0.6's fsWatcher.

You install it via npm istall watchr, use it via require('watchr').watch(path,listeners,next). Listeners will be triggered whenever a change is made on the directory or for anything inside it (including sub-directories and so on) and are in the following format var listener = function(eventName,filePath,fileCurrentStat,filePreviousStat){}

There are three types of events for your listeners at your disposal:

  • change: a file has been modified
  • new: a new file or directory has been created
  • unlink: a file or a directory has been removed

To wrap it all together, it would look like this:

// Require
watchr = require('watchr')

// Watch a directory or file
watchr.watch(path,function(eventName,filePath,fileCurrentStat,filePreviousStat){
	console.log('a watch event occured:',arguments);
});

You can test the above code snippet by installing watchr globally by running npm install -g watchr to install watchr, then watchr [pathToWatch] to watchr a particular path, and performing some file system modifications on that path.

Thanks for using Watchr!

Support

Support can be found in the GitHub Issue Tracker

History

You can discover the history inside the History.md file

License

Licensed under the MIT License
Copyright © 2012 Bevry Pty Ltd
Copyright © 2011 Benjamin Lupton

watchr's People

Contributors

balupton avatar benjie avatar

Stargazers

 avatar

Watchers

 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.