file-system
Advanced tools
Comparing version 2.1.2 to 2.1.3
@@ -263,21 +263,15 @@ /** | ||
function recurse(dirpath) { | ||
// permission bug | ||
try { | ||
fs.readdirSync(dirpath).forEach(function(filename) { | ||
var filepath = path.join(dirpath, filename); | ||
var stats = fs.statSync(filepath); | ||
var relative = path.relative(rootpath, filepath); | ||
var flag = filterCb(relative); | ||
fs.readdirSync(dirpath).forEach(function(filename) { | ||
var filepath = path.join(dirpath, filename); | ||
var stats = fs.statSync(filepath); | ||
var relative = path.relative(rootpath, filepath); | ||
var flag = filterCb(relative); | ||
if (stats.isDirectory()) { | ||
recurse(filepath); | ||
if (flag) callback(filepath); | ||
} else { | ||
if (flag) callback(filepath, filename); | ||
} | ||
}); | ||
} catch(e) { | ||
fs.chmodSync(dirpath, 511); | ||
recurse(dirpath); | ||
} | ||
if (stats.isDirectory()) { | ||
recurse(filepath); | ||
if (flag) callback(filepath); | ||
} else { | ||
if (flag) callback(filepath, filename); | ||
} | ||
}); | ||
} | ||
@@ -284,0 +278,0 @@ |
{ | ||
"name": "file-system", | ||
"version": "2.1.2", | ||
"version": "2.1.3", | ||
"description": "Strengthen the ability of file system", | ||
@@ -5,0 +5,0 @@ "main": "file-system.js", |
@@ -39,3 +39,3 @@ var assert = require("assert"); | ||
it('copy image', function() { | ||
it('copy image', function(done) { | ||
var oldpath = getPath('test.png'); | ||
@@ -47,2 +47,3 @@ var newpath = getPath('var/copy-file/test.async.dest.png'); | ||
assert.equal(file.readFileSync(oldpath).length, file.readFileSync(newpath).length); | ||
done(); | ||
} | ||
@@ -49,0 +50,0 @@ }); |
@@ -73,4 +73,5 @@ var assert = require("assert"); | ||
after(function() { | ||
file.chmodSync(getPath('var/mkdir/mode2'), 511); | ||
file.rmdirSync(getPath('var/mkdir')); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28096
766