Method description:
Synchronized version of stat() .
The method returns a stat array object, including the following information: (The following information is the file information read in the case, non-default value)
{
dev : 0 ,
mode: 33206,
nlink : 1 ,
uid : 0 ,
gid : 0 ,
rdev : 0 ,
ino : 0 ,
size: 378 (bytes) ,
atime : Tue Jun 10 2014 13:57:13 GMT 0800 ,
mtime : Tue Jun 13 2014 09:48:31 GMT 0800 ,
ctime : Tue Jun 10 2014 13:57:13 GMT 0800
}
Grammar:
fs.statSync(path)
Since this method belongs to the fs module, the fs module needs to be introduced before use (var fs= require(“fs”) )
Receive parameters:
path file path
Example:
var fs = require('fs');
var statInfo = fs.statSync('content.txt');
console.log(statInfo);
Source code:
fs.statSync = function(path) {
nullCheck(path);
Return binding.stat(pathModule._makeLong(path));
};