MagicMime.CLI (magic_mime v0.1.0)

Internal module for executing the file command.

Summary

Functions

Executes the file command to detect MIME type for a given file path.

Checks if the file command is available on the system.

Gets the version of the file command.

Validates if a file path exists and is accessible.

Functions

detect_mime_type(path, opts \\ [])

@spec detect_mime_type(
  Path.t(),
  keyword()
) :: {:ok, String.t()} | {:error, term()}

Executes the file command to detect MIME type for a given file path.

file_command_available?(opts \\ [])

@spec file_command_available?(keyword()) :: boolean()

Checks if the file command is available on the system.

get_version(opts \\ [])

@spec get_version(keyword()) :: {:ok, String.t()} | {:error, term()}

Gets the version of the file command.

validate_file_path(path, opts \\ [])

@spec validate_file_path(
  Path.t(),
  keyword()
) :: :ok | {:error, term()}

Validates if a file path exists and is accessible.