首页 Node.js核心模块手册

参数说明


futimes(path, atime, mtime, callback)
path          文件路径
atime         访问时间
mtime         修改时间
callback(     修改后执行,回调函数
  err             执行出错信息,错误(返回错误信息),成功(null)
}

示例


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

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

  }
});