Instructions for the fs.futimesSync method in node.js
- 2020-05-07 19:12:55
- OfStack
method description:
Change the timestamp of the file referenced by the file descriptor provided by 1 file.
Change timestamp for short
syntax:
fs.futimes(fd, atime, mtime, callback)
Since this method belongs to fs module, fs module (var fs= require(" fs ") needs to be introduced before use.)
receive parameters:
fd identifier
atime
mtime
callback callback
Example:
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:
fs.futimes = function(fd, atime, mtime, callback) {
atime = toUnixTimestamp(atime);
mtime = toUnixTimestamp(mtime);
binding.futimes(fd, atime, mtime, makeCallback(callback));
};