方法说明:
同步版的 lchmod() 。
语法:
fs.lchmodSync(fd, mode)
由于该方法属于fs模块,使用前需要引入fs模块(var fs= require(“fs”) )
接收参数:
fd 文件描述符
mode 文件权限
源码:
fs.lchmodSync = function(path, mode) {
var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK);
// prefer to return the chmod error, if one occurs,
// but still try to close, and report closing errors if they occur.
var err, err2;
try {
var ret = fs.fchmodSync(fd, mode);
} catch (er) {
err = er;
}
try {
fs.closeSync(fd);
} catch (er) {
err2 = er;
}
if (err || err2) throw (err || err2);
return ret;
};
}