Home » Nodejs » NodeJS File Statistics

NodeJS File Statistics

Posted by: admin November 29, 2017 Leave a comment

Questions:

I don’t know if this is a valid question but is there a documentation out there describing each property from the result of fs.stat() in nodejs. Because I am trying to find the meaning of each of those properties but no luck.

Thanks!

Answers:

Comments in the node_file.cc source that builds the stat object (BuildsStatsObject function) may conveniently help you out with this. In summary for reference:

  • dev : ID of device containing file
  • ino : inode number
  • mode : protection
  • nlink : number of hard links
  • uid : user ID of owner
  • gid : group ID of owner
  • rdev : device ID (if special file)
  • size : total size, in bytes
  • atime – time of last access
  • mtime – time of last modification
  • ctime – time of last status change

and if POSIX

  • blksize : blocksize for filesystem I/O
  • blocks : number of blocks allocated