Method description:
Changes the timestamp of the file referenced by a file provided by the file descriptor.
Change timestamp for short
grammar:
The code copy is as follows:
fs.futimes(fd, atime, mtime, callback)
Since this method belongs to the fs module, it is necessary to introduce the fs module before use (var fs= require("fs") )
Receive parameters:
fd identifier
atime
mtime
callback callback
example:
The code copy is as follows:
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');
});
});
});
Source code:
The code copy is as follows:
fs.futimes = function(fd, atime, mtime, callback) {
atime = toUnixTimestamp(atime);
mtime = toUnixTimestamp(mtime);
binding.futimes(fd, atime, mtime, makeCallback(callback));
};