(attrs: Attributes)
| 392 | * Get file type from attributes mode bits |
| 393 | */ |
| 394 | export function getFileType(attrs: Attributes): 'file' | 'directory' | 'symlink' | 'other' { |
| 395 | const mode = attrs.mode |
| 396 | const fileType = mode & S_IFMT |
| 397 | |
| 398 | if (fileType === S_IFDIR) return 'directory' |
| 399 | if (fileType === S_IFREG) return 'file' |
| 400 | if (fileType === S_IFLNK) return 'symlink' |
| 401 | return 'other' |
| 402 | } |