node.js中的fs.chmodSync方法使用说明
方法说明:
同步版本的chmod(),该方法用来改写文件的读写权限。
语法:
fs.chmodSync(path,mode)
由于该方法属于fs模块,使用前需要引入fs模块(varfs=require(“fs”))
接收参数:
1.path 文件路径
2.mode 读写权限(如:777)
例子:
varfs=require('fs'), oldFilename="./processId.txt"; fs.chmodSync(oldFilename,777);
源码:
fs.chmodSync=function(path,mode){ nullCheck(path); returnbinding.chmod(pathModule._makeLong(path),modeNum(mode)); };