inodeMimeType - multiple declarations

Function inodeMimeType

Get mime type for stat mode.

string inodeMimeType (
  uint mode
) nothrow @trusted;

This function is Posix only.

Returns

inode/* mime type name for mode or null if unknown. Regular files don't have inode/* type.

Example

assert(inodeMimeType(S_IFCHR) == "inode/chardevice");
assert(inodeMimeType(S_IFBLK) == "inode/blockdevice");
assert(inodeMimeType(S_IFIFO) == "inode/fifo");
assert(inodeMimeType(S_IFSOCK) == "inode/socket");
}

Function inodeMimeType

Get inode mime type for file path.

string inodeMimeType (
  scope const(char)[] filePath
) nothrow @trusted;

Returns

inode/* mime type name for stated path or null if type is unknown or filePath targets regular file.

Note

On non-posix platforms it only cheks if filePath targets directory and returns inode/directory if so.

Example

assert(inodeMimeType("source") == "inode/directory"); //directory
assert(inodeMimeType("dub.json") is null); //regular file
assert(inodeMimeType("test/|nonexistent|") is null); //nonexistent path