Socket
Socket
Sign inDemoInstall

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 - npm Package Compare versions

Comparing version 1.0.0 to 2.0.0

.npmignore

7

History.md
## History
- v2.0 April 19, 2012
- Big rewrite
- Got rid of the delay
- Now always fires events
- Watcher instsances inherit from Node's EventEmitter
- Events for `change`, `unlink` and `new`
- v1.0 February 11, 2012

@@ -4,0 +11,0 @@ - Better support for ignoring hidden files

69

package.json
{
"name": "watchr",
"version": "1.0.0",
"description": "Node.js watching library, as all the other ones suck.",
"homepage": "https://github.com/balupton/watchr",
"version": "2.0.0",
"description": "Provides a better and normalised API between Node's 0.4 watchFile and 0.6's fsWatcher",
"homepage": "https://github.com/bevry/watchr",
"keywords": [
"watching",
"watch",
"files",
"directories",
"smart"
"fswatcher",
"watchfile"
],
"author": {
"name": "Benjamin Lupton",
"email": "b@lupton.cc",
"url": "http://balupton.com"
},
"maintainers": [
{
"name": "Benjamin Lupton",
"email": "b@lupton.cc",
"url": "http://balupton.com"
}
],
"contributors": [
{
"name": "Benjamin Lupton",
"email": "b@lupton.cc",
"url": "http://balupton.com"
}
],
"bugs": {
"url": "https://github.com/balupton/watchr/issues"
},
"licenses": [
{
"type": "MIT",
"url": "http://creativecommons.org/licenses/MIT/"
}
],
"author": "Bevry Pty Ltd <us@bevry.me> (http://bevry.me)",
"maintainers": [
"Benjamin Lupton <b@lupton.cc> (http://balupton.com)"
],
"contributors": [
"Benjamin Lupton <b@lupton.cc> (http://balupton.com)"
],
"bugs": {
"url": "https://github.com/bevry/watchr/issues"
},
"repository" : {
"type": "git",
"url": "http://github.com/balupton/watchr.git"
"url": "http://github.com/bevry/watchr.git"
},
"engines" : {
"node": ">=0.4.0"
},
"dependencies": {
"coffee-script": "1.3.x",
"bal-util": "1.5.x"
},
"devDependencies": {
"docco": "0.3.x",
"bal-util": "1.1.x",
"mocha": "0.11.x"
"mocha": "1.0.x"
},
"engines" : {
"node": ">=0.4.0"
},
"bin": {

@@ -59,3 +43,6 @@ "watchr": "./bin/watchr"

},
"main": "./lib/watchr.coffee"
"scripts": {
"test": "node ./node_modules/mocha/bin/mocha"
},
"main": "./main.js"
}

@@ -1,43 +0,33 @@

## Watchr. Node.js file watching that doesn't suck.
## Watchr
Watchr normalises the node.js watching functionality between 0.4's `fs.watchFile`, and 0.6's `fs.watch`, and adds support for watching entire directories including their far descendants (some call this recursive directory watching)
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){}`
### Using
There are three types of events for your listeners at your disposal:
- JavaScript
- `change`: a file has been modified
- `new`: a new file or directory has been created
- `unlink`: a file or a directory has been removed
``` javascript
// Requires
require('coffee-script'); # watchr dependency
var watchr = require('watchr');
To wrap it all together, it would look like this:
// Watch
watchr.watch(path,function(){
console.log('something changed inside the directory');
});
```
``` javascript
// Require
watchr = require('watchr')
- CoffeeScript
// Watch a directory or file
watchr.watch(path,function(eventName,filePath,fileCurrentStat,filePreviousStat){
console.log('a watch event occured:',arguments);
});
```
``` javascript
# Requires
watchr = require('watchr')
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.
# Watch
watchr.watch path, ->
console.log('something changed inside the directory')
```
Thanks for using Watchr!
## Install
``` bash
npm install coffee-script watchr
```
## Support
Support can be found in the [github issue tracker](https://github.com/balupton/watchr/issues)
Support can be found in the [GitHub Issue Tracker](https://github.com/bevry/watchr/issues)

@@ -47,3 +37,3 @@

You can discover the history inside the [History.md](https://github.com/balupton/watchr/blob/master/History.md#files) file
You can discover the history inside the [History.md](https://github.com/bevry/watchr/blob/master/History.md#files) file

@@ -54,2 +44,3 @@

Licensed under the [MIT License](http://creativecommons.org/licenses/MIT/)
<br/>Copyright &copy; 2011-2012 [Benjamin Arthur Lupton](http://balupton.com)
<br/>Copyright &copy; 2012 [Bevry Pty Ltd](http://bevry.me)
<br/>Copyright &copy; 2011 [Benjamin Lupton](http://balupton.com)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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