Module mimetypeplus.cmds

cmds

Local command line based utilities for mime type checking.

Global variables

var FILE_CMD : Optional[LiteralString]

Holds either the system's path to the 'mimetype' command's executable, or None, if it wasn't found.

var MIMETYPE_CMD : Optional[LiteralString]

Holds either the system's path to the 'xdg-mime' command's executable, or None, if it wasn't found.

Functions

def file_cmd_mime_type_from_path(path: Union[pathlib.Path, os.PathLike, str]) ‑> Optional[str]

file_cmd_mime_type_from_path Runs the system's 'file' command (if found) on the given path.

Arguments

path - The local path to the file on the system.

Returns

None if the type is not found, or 'file' is not acessable in the current environment, or a string of the mime type.

def mimetype_cmd_mime_type_from_path(path: Union[pathlib.Path, os.PathLike, str]) ‑> Optional[str]

mimetype_cmd_mime_type_from_path Runs the system's 'mimetype' command (if found) on the given path.

Arguments

path - The local path to the file on the system.

Returns

None if the type is not found, or 'mimetype' is not acessable in the current environment, or a string of the mime type.

def xdgmime_cmd_mime_type_from_path(path: Union[pathlib.Path, os.PathLike, str]) ‑> Optional[str]

xdgmime_cmd_mime_type_from_path Runs the system's 'xdg-mime' command (if found) on the given path.

Arguments

path - The local path to the file on the system.

Returns

None if the type is not found, or 'xdg-mime' is not acessable in the current environment, or a string of the mime type.