New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

chmodr

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chmodr - npm Package Compare versions

Comparing version

to
0.1.0

25

chmodr.js

@@ -11,7 +11,11 @@ module.exports = chmodr

// doesn't exist. give up.
if (er && er.code !== "ENOTDIR") return cb(er)
if (er || !children.length) return fs.chmod(p, mode, cb)
if (er && er.code !== "ENOTDIR")
return cb(er)
var isDir = !er
var m = isDir ? dirMode(mode) : mode
if (er || !children.length)
return fs.chmod(p, m, cb)
var len = children.length
, errState = null
var errState = null
children.forEach(function (child) {

@@ -23,3 +27,3 @@ chmodr(path.resolve(p, child), mode, then)

if (er) return cb(errState = er)
if (-- len === 0) return fs.chmod(p, mode, cb)
if (-- len === 0) return fs.chmod(p, dirMode(mode), cb)
}

@@ -37,3 +41,3 @@ })

}
if (!children.length) return fs.chmodSync(p, mode)
if (!children.length) return fs.chmodSync(p, dirMode(mode))

@@ -43,3 +47,12 @@ children.forEach(function (child) {

})
return fs.chmodSync(p, mode)
return fs.chmodSync(p, dirMode(mode))
}
// If a party has r, add x
// so that dirs are listable
function dirMode(mode) {
if (mode & 0400) mode |= 0100
if (mode & 040) mode |= 010
if (mode & 04) mode |= 01
return mode
}

@@ -5,3 +5,3 @@ {

"description": "like `chmod -R`",
"version": "0.0.1",
"version": "0.1.0",
"repository": {

@@ -8,0 +8,0 @@ "type": "git",