treeMimeType

Detect MIME type of mounted device using treemagic files.

  1. string treeMimeType(string mountPoint, string treemagicPath)
  2. string treeMimeType(string mountPoint, const(string)[] mimePaths)
    @safe nothrow
    string
    treeMimeType
    (
    string mountPoint
    ,
    scope const(string)[] mimePaths
    )

Parameters

mountPoint string

Path to mount point of device.

mimePaths const(string)[]

Base mime directories where treemagic files are usually placed.

Return Value

Type: string

MIME type name or null if could not detect.

Examples

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);

See Also

mime.paths.mimePaths

Meta