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

filewatcher

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

filewatcher - npm Package Compare versions

Comparing version 2.0.3 to 2.1.0

.eslintrc

32

index.js
var fs = require('fs')
, util = require('util')
, events = require('events')
, EventEmitter = events.EventEmitter
var util = require('util')
var events = require('events')
var EventEmitter = events.EventEmitter
var outOfFileHandles = false
module.exports = function(opts) {

@@ -27,2 +29,5 @@ return new FileWatcher(opts)

// don't add files after we ran out of file handles
if (outOfFileHandles && !this.polling) return
// ignore files that don't exist or are already watched

@@ -37,2 +42,3 @@ if (this.watchers[file] || !fs.existsSync(file)) return

fs.stat(file, function(err, stat) {
if (!self.watchers[file]) return

@@ -47,4 +53,6 @@

if (!stat) return self.emit('change', file, { deleted: true })
if (stat.isDirectory() || stat.mtime > mtime) {
if (!stat) {
self.emit('change', file, { deleted: true })
}
else if (stat.isDirectory() || stat.mtime > mtime) {
mtime = stat.mtime

@@ -67,5 +75,13 @@ self.emit('change', file, stat)

catch (err) {
// emit fallback event if we ran out of file handles
if (err.code == 'EMFILE') this.emit('fallback', this.poll())
else this.emit('error', err)
if (err.code == 'EMFILE') {
if (this.opts.fallback !== false) {
// emit fallback event if we ran out of file handles
var count = this.poll()
this.add(file)
this.emit('fallback', count)
return
}
outOfFileHandles = true
}
this.emit('error', err)
}

@@ -72,0 +88,0 @@ }

{
"name": "filewatcher",
"version": "2.0.3",
"version": "2.1.0",
"description": "Wrapper around fs.watch with fallback to fs.watchFile",

@@ -19,11 +19,8 @@ "author": "Felix Gnass",

"scripts": {
"test": "mocha"
"test": "ulimit -n 100 && ULIMIT=`ulimit -n` node test"
},
"devDependencies": {
"mocha": "~1.14.0",
"should": "~2.1.0",
"rimraf": "~2.2.2",
"posix": "~1.0.3"
},
"dependencies": {}
"tap": "^0.5.0"
}
}

@@ -44,3 +44,3 @@ # filewatcher

Copyright (c) 2013 Felix Gnass
Copyright (c) 2013-2015 Felix Gnass

@@ -47,0 +47,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy

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