modeString method
The mode value as a human-readable string.
The string is in the format "rwxrwxrwx", reflecting the user, group, and world permissions to read, write, and execute the file system object, with "-" replacing the letter for missing permissions. Extra permission bits may be represented by prepending "(suid)", "(guid)", and/or "(sticky)" to the mode string.
Implementation
@override
String modeString() {
var permissions = mode & 0xFFF;
const codes = [
'---', '--x', '-w-', '-wx',
'r--', 'r-x', 'rw-', 'rwx',
];
return [
if ((permissions & 0x800) != 0) "(suid) ",
if ((permissions & 0x400) != 0) "(guid) ",
if ((permissions & 0x200) != 0) "(sticky) ",
codes[(permissions >> 6) & 0x7],
codes[(permissions >> 3) & 0x7],
codes[permissions & 0x7]
].join();
}