首页 Node.js核心模块手册

参数说明


fchmod(path, mode, callback)
path           文件路径
mode           文件读写权限(参考 mode表)
callback(      回调函数
  err              执行出错信息,错误(返回错误信息),成功(null)
)

示例


var fs = require("fs");
fs.open("./liboke/test.txt", "w+", function(err, fd){
  if(err){
    console.log("打开文件失败");
  }else{

    fs.fchmod(fd, 0666, function(err){
      if(err) console.log("失败");
      else console.log("成功");
    });

  }
});