Description of the fs. futimes method in node. js, node. jsfs. futimes
Method description:
Changes the timestamp of the file referenced by the file descriptor provided by a file.
Change Timestamp
Syntax:
Copy codeThe 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:
Copy codeThe 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:
Copy codeThe Code is as follows:
Fs. futimes = function (fd, atime, mtime, callback ){
Atime = toUnixTimestamp (atime );
Mtime = toUnixTimestamp (mtime );
Binding. futimes (fd, atime, mtime, makeCallback (callback ));
};