File Stats
Path:
/src/method/stat.coffeecompiled to/lib/method/stat.js
Thefs.stat() call is extended by cached results. The io lookup result
is cached for one second, so that multiple calls don’t check on disk each time.
There are stat() and lstat() methods available which differ in the handling of
softlinks. While stat() will follow the softlink and analyze the file it is pointing
to, lstat() will analyse the softlink inode itself.
Stats objects returned from one of the stats-methods have the following methods:
isFile()-Booleantrue if this is a plain fileisDirectory()-Booleantrue if this is a directoryisBlockDevice()-Booleantrue if this is a block deviceisCharacterDevice()-Booleantrue if this is a character deviceisSymbolicLink()-Booleantrue if this is a symbolic link (only possible withlstat())isFIFO()-Booleantrue if this is a FIFO pipeisSocket()-Booleantrue if this is a UNIX socket
And if it is a file also the following properties:
dev- device number (i.e. 2114)ino- unique inode number (i.e. 48064969)mode- access mode (i.e. 33188 - octal: 100644)nlink- number of links (i.e. 1) more than one means there are some hard links, toouid- user id (i.e. 85)gid- group id (i.e. 100)rdev- flag showing if this is based on a remote device (i.e. 0)size- of file in bytes (i.e. 527)blksize- IO block size for this file (i.e. 4096)blocks- total number of blocks used by this file (i.e. 8)atime-Dateof last access of file (i.e. Mon, 10 Oct 2011 23:24:11 GMT)mtime-Dateof last file modification (i.e. Mon, 10 Oct 2011 23:24:11 GMT)ctime-Dateof last inode change time (i.e. Mon, 10 Oct 2011 23:24:11 GMT)birthtime-Dateof file creation (i.e. Mon, 10 Oct 2011 23:24:11 GMT)
stat()
Usage:
stat(path, cb)
- Parameter
-
path-String|Bufferlocal path to checkcb-function(<Error>, <fs.Stats>)callback which gets anErroror aStatsobject.
statSync()
Usage:
statSync(path)
- Parameter
-
path-String|Bufferlocal path to check
- Return
Statsan statss objects- Throws
-
Errorif io problems occure
lstat()
Usage:
lstat(path, cb)
- Parameter
-
path-String|Bufferlocal path to checkcb-function(<Error>, <fs.Stats>)callback which gets anErroror aStatsobject.
lstatSync()
Usage:
lstatSync(path)
- Parameter
-
path-String|Bufferlocal path to check
- Return
Statsan statss objects- Throws
-
Errorif io problems occure