🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

sane

Package Overview
Dependencies
Maintainers
1
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sane - npm Package Compare versions

Comparing version

to
0.5.1

4

index.js

@@ -5,3 +5,3 @@ var fs = require('fs');

var walker = require('walker');
var platform = require('os').platform()
var platform = require('os').platform();
var minimatch = require('minimatch');

@@ -46,3 +46,3 @@ var EventEmitter = require('events').EventEmitter;

this.globs = opts.glob || [];
if (!Array.isArray(this.globs)) this.globs = [this.glob];
if (!Array.isArray(this.globs)) this.globs = [this.globs];
this.watched = Object.create(null);

@@ -49,0 +49,0 @@ this.changeTimers = Object.create(null);

{
"name": "sane",
"version": "0.5.0",
"version": "0.5.1",
"description": "Sane aims to be fast, small, and reliable file system watcher.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -5,4 +5,8 @@ sane

I've been driven to insanity by node filesystem watcher wrappers.
Sane aims to be fast, small, and reliable file system watcher.
Sane aims to be fast, small, and reliable file system watcher. It does that by:
* Always use fs.watch (unless polling is forced) and sensibly workaround the various issues with it
* Not introducing native components
* Not use polling by default and be very slow
## Install

@@ -9,0 +13,0 @@

@@ -37,3 +37,3 @@ var os = require('os');

}
})
});

@@ -219,2 +219,23 @@ describe('sane(file)', function() {

describe('sane shortcut alias', function () {
beforeEach(function () {
this.watcher = sane(testdir, '**/file_1');
});
afterEach(function() {
this.watcher.close();
});
it('allows for shortcut mode using just a string as glob', function (done) {
this.watcher.on('change', function (filepath) {
assert.ok(filepath.match(/file_1/));
done();
});
this.watcher.on('ready', function() {
fs.writeFileSync(jo(testdir, 'file_1'), 'wow');
});
});
});
function defer(fn) {

@@ -221,0 +242,0 @@ setTimeout(fn, isPolling ? 1000 : 300);