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

node-watch

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-watch - npm Package Compare versions

Comparing version 0.2.3 to 0.2.4

11

lib/watch.js

@@ -143,10 +143,9 @@ /**

// Due to the unstalbe fs.watch(), swtiches to watch its parent
// directory when watching a single file, instead of watch it
// directly. And then triggers the callback function whenever the
// logged filename matches it.
// Due to the unstalbe fs.watch(), if the `fpath` is a file then
// switch to watch its parent directory instead of watch it directly.
// Once the logged filename matches it then triggers the callback function.
if (is.File(fpath)) {
var parent = path.resolve(fpath, '..');
fs.watch(parent, function(err, fname) {
if (path.basename(fpath) == fname) {
if (path.basename(fpath) === fname) {
normalizeCall(fpath, cb);

@@ -170,2 +169,2 @@ }

module.exports = watch;
{
"name": "node-watch"
, "version": "0.2.3"
, "description": "NodeJS file.watch wrapper"
, "version": "0.2.4"
, "description": "fs.watch() wrapper of Nodejs "
, "url": "https://github.com/yuanchuan/node-watch"

@@ -6,0 +6,0 @@ , "author": "yuanchuan <yuanchuan23@gmail.com> (http://yuanchuan.name)"

#Node-watch
This program is part of Markab(an instant mockup tool, still under development).
There are 3 problems when using the native fs.watch() function of Nodejs:
The difference bewteen other nodewatch tools is that it does not differentiate event like "rename" or "delete". Once there is a change, the callback function will be triggered.
1. It won't watch a directory recursively.
2. When modifying a file inside a watched directory, the callback function will be triggered multiple times.
3. when modifying a watched file with an editor like vim, the callback function will only be triggered one time and then it is unwatched.
##Feature
And this module is trying to solve those problems.
*Recursively watch a directory*
(In current version it does not differentiate event like "rename" or "delete". Once there is a change, the callback function will be triggered.)
##Installation
## Installation

@@ -13,0 +15,0 @@ npm install node-watch

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