Method description:
Synchronous version of fstat().
The method returns a stat array object, containing the following information: (The following information is the file information read in the case, not the default value)
The code copy is as follows:
{
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 <China Standard Time>,
mtime : Tue Jun 13 2014 09:48:31 GMT +0800 <China Standard Time>,
ctime : Tue Jun 10 2014 13:57:13 GMT +0800 <China Standard Time>
}
grammar:
The code copy is as follows:
fs.fstatSync(fd)
Since this method belongs to the FS module, it is necessary to introduce the FS module before use (var fs= require("fs") )
Receive parameters:
fd file descriptor
example:
The code copy is as follows:
var fs = require('fs');
fs.open('content.txt', 'a', function(err,fd){
if(err){
throw err;
}
console.log('file open');
var statInfo = fs.fstatSync(fd);
console.log(statInfo);
fs.close(fd , function(){
console.log('file close');
})
})
Source code:
The code copy is as follows:
fs.fstatSync = function(fd) {
return binding.fstat(fd);
};