15

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!

Pero P.
  • 25,813
  • 9
  • 61
  • 85
Richeve Bebedor
  • 2,138
  • 4
  • 26
  • 40
  • Have you looked in the source code? https://github.com/joyent/node/blob/master/lib/fs.js – Hector Correa Aug 02 '12 at 23:22
  • 2
    Surprising this still isn't documented... you shouldn't have to look in the source code to grasp the meaning of a returned object's properties. – Wes Johnson Jan 10 '14 at 23:54

1 Answers1

22

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
Pero P.
  • 25,813
  • 9
  • 61
  • 85
  • 2
    The source of node_file.cc has been modified in the meanwhile with the remotion of the comments: to see the version of the 2nd of august 2012 (with the comments) go to https://github.com/joyent/node/blob/f0ce98441ff7315e6a6c268dabcec58fc37da926/src/node_file.cc – reallynice Mar 31 '14 at 15:09
  • Thanks @niconic, I've updated the link with the relevant code highlighted. – Pero P. Apr 02 '14 at 23:27