Socket
Socket
Sign inDemoInstall

next

Package Overview
Dependencies
Maintainers
1
Versions
2773
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

next - npm Package Compare versions

Comparing version 0.2.9 to 0.2.10

71

lib/fs/readdir-files-deep.js

@@ -5,37 +5,46 @@ // Read all filenames from directory and it's subdirectories

var call = Function.prototype.call
, fs = require('fs')
, aritize = require('es5-ext/lib/Function/prototype/aritize')
, invoke = require('es5-ext/lib/Function/invoke')
, k = require('es5-ext/lib/Function/k')
, flatten = call.bind(require('es5-ext/lib/Array/prototype/flatten'))
, deferred = require('deferred')
, concat = aritize.call(String.prototype.concat, 1)
var readdir = require('fs').readdir
, normalize = require('../path/normalize')
, readdir = deferred.promisify(fs.readdir)
, stat = deferred.promisify(fs.lstat);
, read;
module.exports = function self (path, callback) {
readdir(path = normalize(path))
(function (files) {
return deferred.map(files, function (file) {
var npath = normalize(path + '/' + file);
return stat(npath)
(function (stats) {
if (stats.isFile()) {
return file;
} else if (stats.isDirectory()) {
return deferred.promisify(self)(npath)
(invoke('map', function (subfile) {
return normalize(file + '/' + subfile);
read = function (path, files, cb) {
var waiting = files.length, result = [];
if (!waiting) {
cb(null, result);
return;
}
files.forEach(function (file) {
readdir(path + '/' + file, function (err, files) {
if (err) {
switch (err.code) {
case "UNKNOWN":
case "ENOTDIR":
result.push(file);
}
if (!--waiting) {
cb(null, result);
}
} else {
read(path + '/' + file, files, function (err, res) {
result = result.concat(res.map(function (name) {
return normalize(file + '/' + name);
}));
} else {
return null;
}
}, file);
})
(invoke('filter', Boolean))
(flatten);
}).end(callback);
if (!--waiting) {
cb(null, result);
}
});
}
});
});
};
module.exports = function self (path, cb) {
readdir(path = normalize(path), function (err, files) {
if (err) {
cb(err);
return;
}
read(path, files, cb);
});
};
{
"name": "next",
"version": "0.2.9",
"version": "0.2.10",
"description": "Node.js extensions",

@@ -5,0 +5,0 @@ "keywords": ["node", "nodejs", "node.js", "extensions", "addons", "extras"],

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