This article mainly introduces node. fs. futimes method usage instructions. This article introduces fs. futimes method description, syntax, receive parameters, use instances, and implement source code. For more information, see
Method description:
Changes the timestamp of the file referenced by the file descriptor provided by a file.
Change timestamp
Syntax:
The code is as follows:
Fs. futimes (fd, atime, mtime, callback)
Because this method belongs to the fs module, we need to introduce the fs module (var fs = require ("fs") before use "))
Receiving parameters:
Fd identifier
Atime
Mtime
Callback
Example:
The code is as follows:
Fs. open ('/path/demo1.txt', 'A', function (err, fd ){
If (err ){
Throw err;
}
Fs. futimes (fd, 1388648322,138 8648322, function (err ){
If (err ){
Throw err;
}
Console. log ('futimes complete ');
Fs. close (fd, function (){
Console. log ('done ');
});
});
});
Source code:
The code is as follows:
Fs. futimes = function (fd, atime, mtime, callback ){
Atime = toUnixTimestamp (atime );
Mtime = toUnixTimestamp (mtime );
Binding. futimes (fd, atime, mtime, makeCallback (callback ));
};