| 1 |
"use strict"; |
| 2 |
|
| 3 |
module.exports = function (stat) { |
| 4 |
if (stat.isFile()) { |
| 5 |
return "file"; |
| 6 |
} |
| 7 |
if (stat.isDirectory()) { |
| 8 |
return "directory"; |
| 9 |
} |
| 10 |
if (stat.isSymbolicLink && stat.isSymbolicLink()) { |
| 11 |
return "symbolicLink"; |
| 12 |
} |
| 13 |
if (stat.isSocket()) { |
| 14 |
return "socket"; |
| 15 |
} |
| 16 |
if (stat.isBlockDevice()) { |
| 17 |
return "blockDevice"; |
| 18 |
} |
| 19 |
if (stat.isCharacterDevice()) { |
| 20 |
return "characterDevice"; |
| 21 |
} |
| 22 |
if (stat.isFIFO()) { |
| 23 |
return "FIFO"; |
| 24 |
} |
| 25 |
throw new Error("Cannot detect type"); |
| 26 |
}; |