Instructions for the fs.utimesSync method in node.js
- 2020-05-05 10:55:46
- OfStack
method description:
utimes(), which synchronizes to modify the timestamp of the file.
syntax:
fs.utimesSync(path, atime, mtime)
Since this method belongs to the fs module, it is necessary to introduce the fs module (var fs= require(" fs "))
before using itreceive parameters:
path file path
mtime When the contents of the file change, the modification date of the file is updated with
atime access time, which indicates the time and date the file was last accessed. Each time an application or service reads a file using a system call, the access time of the file is updated.
Example of :
var fs = require('fs');
fs.utimesSync('125.txt', atime, mtime);
source code:
fs.utimesSync = function(path, atime, mtime) {
nullCheck(path);
atime = toUnixTimestamp(atime);
mtime = toUnixTimestamp(mtime);
binding.utimes(pathModule._makeLong(path), atime, mtime);
};