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

findit

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

findit - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

10

index.js

@@ -12,2 +12,6 @@ var EventEmitter = require('events').EventEmitter;

emitter = new EventEmitter;
emitter.stop = function () {
emitter._stopped = true;
emitter.emit('stop');
};
emitter._pending = 0;

@@ -28,2 +32,3 @@ emitter._seen = {};

else fs.lstat(dir, function onstat (err, stat) {
if (emitter._stopped) return;
if (err) return finish();

@@ -35,2 +40,3 @@ emitter._seen[stat.ino || dir] = true;

fs.readlink(dir, function (err, rfile) {
if (emitter._stopped) return;
if (err) return finish();

@@ -75,2 +81,3 @@ var file_ = path.resolve(dir, rfile);

function onreaddir (err, files) {
if (emitter._stopped) return;
emitter._pending --;

@@ -84,2 +91,3 @@ if (err) return check();

fs.lstat(file, function (err, stat) {
if (emitter._stopped) return;
if (err) check()

@@ -104,2 +112,3 @@ else onstat(file, stat)

fs.readlink(file, function (err, rfile) {
if (emitter._stopped) return;
if (err) return check();

@@ -110,2 +119,3 @@ var file_ = path.resolve(path.dirname(file), rfile);

fs.lstat(file_, function (err, stat_) {
if (emitter._stopped) return;
if (err) return check();

@@ -112,0 +122,0 @@

2

package.json
{
"name": "findit",
"version": "1.0.1",
"version": "1.1.0",
"description": "walk a directory tree recursively with events",

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

@@ -8,24 +8,27 @@ var find = require('../');

var finder = find(__dirname + '/stop');
var finder = find(__dirname + '/..');
var files = [];
var stopped = false;
finder.on('file', function (file) {
files.push(path.relative(__dirname, file));
files.push(file);
if (files.length === 3) {
finder.stop();
stopped = true;
}
else if (stopped) {
t.fail("files didn't stop");
}
});
finder.on('directory', function (dir, stat, stop) {
var d = path.basename(dir);
if (d === 'c') stop();
else if (d === 'w') stop();
if (stopped) t.fail("directories didn't stop");
});
finder.on('end', function () {
t.deepEqual(files.sort(), [
'stop/q/x',
'stop/q/y',
'stop/q/z/m',
'stop/q/z/n',
'stop/r/a',
'stop/r/b'
]);
t.fail("shouldn't have ended");
});
finder.on('stop', function () {
t.equal(files.length, 3);
});
});

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