2017-08-18 19:57:42 +00:00
|
|
|
function getFileType(stats) {
|
2017-11-25 21:25:01 +00:00
|
|
|
if (stats.isFile()) return "file"
|
|
|
|
if (stats.isDirectory()) return "directory"
|
|
|
|
if (stats.isBlockDevice()) return "blockDevice"
|
|
|
|
if (stats.isCharacterDevice()) return "characterDevice"
|
|
|
|
if (stats.isSymbolicLink()) return "symlink"
|
|
|
|
if (stats.isSocket()) return "socket"
|
|
|
|
if (stats.isFIFO()) return "fifo"
|
|
|
|
return "unknown"
|
2017-08-18 19:57:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = getFileType
|