Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

watchr

Package Overview
Dependencies
Maintainers
1
Versions
122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

watchr

Provides a better and normalised API between Node's 0.4 watchFile and 0.6's fsWatcher

  • 2.0.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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

Keywords

FAQs

Package last updated on 18 Apr 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc