Comparing version 1.6.2 to 1.6.3
@@ -22,11 +22,18 @@ // Generated by CoffeeScript 1.3.1 | ||
if (global.maxNumberOfOpenFiles == null) { | ||
global.maxNumberOfOpenFiles = 500; | ||
global.maxNumberOfOpenFiles = 100; | ||
} | ||
if (global.waitingToOpenFileDelay == null) { | ||
global.waitingToOpenFileDelay = 100; | ||
} | ||
balUtilPaths = { | ||
openFile: function(next) { | ||
if (global.numberOfOpenFiles < 0) { | ||
throw new Error("balUtilPaths.openFile: the numberOfOpenFiles is [" + global.numberOfOpenFiles + "] which should be impossible..."); | ||
} | ||
if (global.numberOfOpenFiles >= global.maxNumberOfOpenFiles) { | ||
setTimeout(function() { | ||
return balUtilPaths.openFile(next); | ||
}, 50); | ||
}, global.waitingToOpenFileDelay); | ||
} else { | ||
@@ -176,9 +183,11 @@ ++global.numberOfOpenFiles; | ||
isDirectory: function(path, next) { | ||
balUtilPaths.stat(path, function(err, stat) { | ||
balUtilPaths.closeFile(); | ||
if (err) { | ||
console.log("balUtilPaths.isDirectory: stat failed on: " + path); | ||
return typeof next === "function" ? next(err) : void 0; | ||
} | ||
return typeof next === "function" ? next(null, stat.isDirectory(), stat) : void 0; | ||
balUtilPaths.openFile(function() { | ||
return balUtilPaths.stat(path, function(err, stat) { | ||
balUtilPaths.closeFile(); | ||
if (err) { | ||
console.log("balUtilPaths.isDirectory: stat failed on: " + path); | ||
return typeof next === "function" ? next(err) : void 0; | ||
} | ||
return typeof next === "function" ? next(null, stat.isDirectory(), stat) : void 0; | ||
}); | ||
}); | ||
@@ -185,0 +194,0 @@ return this; |
{ | ||
"name": "bal-util", | ||
"version": "1.6.2", | ||
"version": "1.6.3", | ||
"description": "Common utility functions for Node.js used and maintained by Benjamin Lupton", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/balupton/bal-util", |
52570
1488