Function implicitParent

Get implicit parent type if mimeType. This is text/plain for all text/* types and application/octet-stream for all streamable types.

string implicitParent (
  scope const(char)[] mimeType
) pure nothrow @safe;

Returns

text/plain for text-based types, application/octet-stream for streamable types, null otherwise.

Note

text/plain and application/octet-stream are not considered as parents of their own.

Example

assert(implicitParent("text/hmtl") == "text/plain");
assert(implicitParent("text/plain") == null);

assert(implicitParent("image/png") == "application/octet-stream");
assert(implicitParent("audio/ogg") == "application/octet-stream");
assert(implicitParent("video/mpeg") == "application/octet-stream");
assert(implicitParent("application/xml") == "application/octet-stream");
assert(implicitParent("application/octet-stream") == null);

assert(implicitParent("inode/directory") == null);
assert(implicitParent("x-content/unix-software") == null);

assert(implicitParent("not a mimetype") == null);