首页 Node.js核心模块手册

参数说明


futimesSync(path, atime, mtime)
path          文件路径
atime         访问时间
mtime         修改时间

示例


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

    try{
      fs.futimesSync(fd, new Date(), new Date());
      console.log("成功");
    }catch(e){
      console.log("失败");
    }

  }
});