How does one override default icons used to dislpay uploaded files from within a module instead of a theme? I'm attempting to add a custom icon for file uploads via a module. However, all I'm finding online is advice on using a theme function (How to change File field icons (without changing core)?). I want this in a module to make it work across various themes. I found file_icon_path, but am not sure how to implement it. How would this be done in a module?
I think you would want to do something along these lines:

function YOURMODULE_theme_registry_alter(&amp;$theme_registry) {

  if (!empty($theme_registry['file_icon']['function'])) {
    $theme_registry['file_icon']['function'] = 'YOURMODULE_file_icon';
  }

}


and then create YOURMODULE_file_icon() based upon the core theme_file_icon():

/**
 * Returns HTML for an image with an appropriate icon for the given file.
 *
 * @param $variables
 *   An associative array containing:
 *   - file: A file object for which to make an icon.
 *   - icon_directory: (optional) A path to a directory of icons to be used for
 *     files. Defaults to the value of the "file_icon_directory" variable.
 *
 * @ingroup themeable
 */
function YOURMODULE_file_icon($variables) {
  $file = $variables['file'];
  $icon_directory = $variables['icon_directory'];

  $mime = check_plain($file-&gt;filemime);
  $icon_url = file_icon_url($file, $icon_directory);

  return '&lt;img class="file-icon" alt="" title="' . $mime . '" src="' . $icon_url . '" /&gt;';
}


and change up either $icon_directory to point within your module and include all of the various file type icons there, or do a switch or if on the $mime type and grab them from wherever you want, eg, if it's the special mime type you want, grab them from your module's directory, otherwise, grab them from the core/default directory.