treeMimeType - multiple declarations

Function treeMimeType

Detect MIME type of mounted device using treemagic file.

string treeMimeType (
  string mountPoint,
  scope string treemagicPath
) @trusted;

Parameters

NameDescription
mountPoint Path to mount point of device.
treemagicPath Path to treemagic file.

Returns

MIME type name or null if could not detect.

See Also

mime.files.treeMagicFileReader

Function treeMimeType

Detect MIME type of mounted device using treemagic files.

string treeMimeType (
  string mountPoint,
  scope const(string)[] mimePaths
) nothrow @safe;

Parameters

NameDescription
mountPoint Path to mount point of device.
mimePaths Base mime directories where treemagic files are usually placed.

Returns

MIME type name or null if could not detect.

See Also

mimePaths

Example

auto mimePaths = ["test/mime"];
assert(treeMimeType("test/media/photos", mimePaths) == "x-content/image-dcf");
assert(treeMimeType("test/media/installer", mimePaths) == "x-content/unix-software");
assert(treeMimeType("test", mimePaths) == null);