DIV CSS 佈局教程網

Node.js 中 fs.futimesSync 方法的詳解與使用教學
編輯:關於JavaScript     

方法說明:

更改指定檔案描述符所引用檔案的時間戳,簡稱更改時間戳(同步版本)。

語法:

代碼如下:
fs.futimes(fd, atime, mtime, callback)

由於此法屬於 fs 模組,使用前需先引入 fs 模組(var fs = require("fs"))。

參數:

fd             識別符

atime

mtime

callback   回呼

範例:

代碼如下:
fs.open('/path/demo1.txt', 'a', function (err, fd) {
  if (err) {
    throw err;
  }
  fs.futimes(fd, 1388648322, 1388648322, function (err) {
    if (err) {
      throw err;
    }
    console.log('futimes complete');
    fs.close(fd, function () {
      console.log('Done');
    });
  });
});

源碼:

代碼如下:
fs.futimes = function(fd, atime, mtime, callback) {
  atime = toUnixTimestamp(atime);
  mtime = toUnixTimestamp(mtime);
  binding.futimes(fd, atime, mtime, makeCallback(callback));
};

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved