Return mime type for the given path,
otherwise default to exports.defaultMime
("application/octet-stream").

@param {String} path
@return {String}
@api public
973120
function getMime(path) {
          var index = String(path).lastIndexOf(".");
          if (index < 0) {
              return defaultMime;
          }
          var type = exports.mime.types[path.substring(index).toLowerCase()] || defaultMime;
          return (/(text|javascript)/).test(type)
            ? type + "; charset=utf-8"
            : type;
      }
699723
public static function mimetype(string $path): string
    {
        $result = @finfo_file(finfo_open(FILEINFO_MIME_TYPE), $path);
        return $result !== false ? $result : '';
    }
1011856
public function getMimeType($path, $default = "application/octet-stream")
    {

        $finfo = finfo_open(FILEINFO_MIME_TYPE); // return mime type ala mimetype extension
        $fmtype = finfo_file($finfo, $path);

        finfo_close($finfo);

        return !empty($fmtype) ? $fmtype : $default;
    }
532097
function mimeTypeFromFilename( filename ) {
	var ext = filename.split(".").pop().toLowerCase();
	return mime.lookup(filename) || "application/octet-stream";
}
12295
function (path) {
            var result = path.match(splitPathRe) || [],
                root = result[1] || '',
                dir = result[2] || '';

            if (!root && !dir) {
                // No dirname
                return '.';
            }

            if (dir) {
                // It has a dirname, strip trailing slash
                dir = dir.substring(0, dir.length - 1);
            }

            return root + dir;
        }
425803
static String _getMimeType(String uriOrPath) {
        String mime = MIME_MAP.get(__getExtension(uriOrPath));

        if (mime == null) {
            mime = DEFAULT_MIME;
        }

        return mime;
    }
330161
public function getMimetype($path)
    {
        //创建一个临时文件
        $tmp_file = FileFunction::getTmpFile();

        file_put_contents($tmp_file, $this->readStream($path)['stream']);

        $mime_type = FileFunction::getFileMimeType($tmp_file);

        //删除临时文件

        FileFunction::deleteTmpFile($tmp_file);

        return ['mimetype' => $mime_type];
    }
981553
public static function getMIME($path)
	{
		// Получим расширение файла
        $file_ext = pathinfo($path, PATHINFO_EXTENSION);

		// Обработаем тип получаемого файла и вернем его расширение если файл поддерживается
        if (isset(self::$ExtensionMIME[$file_ext])) return self::$ExtensionMIME[$file_ext];

		// Ничего не вышло =(
		return 'application/octet-stream';
	}
947642
function(path) {
    return (path && path.match(/^[a-z]:\\/i)) ? path.charAt(0).toLowerCase() + path.slice(1) : path;
  }
149962
function (path) {
        if (_.isArray(path)) {
            return path;
        } else if (_.isString(path)) {
            return path.split('.');
        }
    }
926204
function getFile(path) {
	const
		cache = validateCache(path, filesCache);

	if (!cache.fromCache) {
		filesCache[path] = {
			mtime: cache.mtime,
			content: fs.readFileSync(path, 'utf-8')
		};
	}

	return filesCache[path].content;
}
917221
def guess_content_type_and_encoding(path):
    
    for ext, content_type in _EXTENSION_TO_MIME_TYPE.items():
        if path.endswith(ext):
            return content_type

    content_type, encoding = mimetypes.guess_type(path)
    content_type = content_type or "application/binary"
    return content_type, encoding
497724
def get_content_type(self):
        
        mime_type, encoding = mimetypes.guess_type(self.filepath)
        if encoding == "gzip":
            return "application/gzip"
        elif encoding is not None:
            return "application/octet-stream"
        elif mime_type is not None:
            return mime_type
        # if mime_type not detected, use application/octet-stream
        else:
            return "application/octet-stream"
270926
def guess_mime_type(self, path):
		
		_, ext = posixpath.splitext(path)
		if ext in self.extensions_map:
			return self.extensions_map[ext]
		ext = ext.lower()
		return self.extensions_map[ext if ext in self.extensions_map else '']
1288295
public function getMimetype($path)
    {
        $metadata = $this->read($path);

        if ($metadata === false) {
            return false;
        }

        $metadata['mimetype'] = Util::guessMimeType($path, $metadata['contents']);

        return $metadata;
    }
472780
public function getMimeType(string $path): string
    {
        $location = $this->applyBasePath($path);
        $finfo    = new Finfo(FILEINFO_MIME_TYPE);
        $mimetype = $finfo->file($location);

        if (in_array($mimetype, ['application/octet-stream', 'inode/x-empty'])) {
            $mimetype = MimeType::detectByFilePath($location);
        }

        return $mimetype;
    }
32253
public static function guessMimeType($path, $content)
    {
        $mimeType = MimeType::detectByContent($content);

        if ( ! (empty($mimeType) || in_array($mimeType, ['application/x-empty', 'text/plain', 'text/x-asm']))) {
            return $mimeType;
        }

        return MimeType::detectByFilename($path);
    }