Get the mimetype of the file at the specified path.

@param string $file
Path of the file to get the mimetype of.

@return string Mimetype of file at the specified path.
510924
public static function getMimetype(string $file): string
    {
        $finfo = finfo_open(FILEINFO_MIME_TYPE); // return mime type ala mimetype extension
        $mimetype = finfo_file($finfo, $file);
        finfo_close($finfo);
        
        return $mimetype;
    }
700803
public function getMimetype($force = false) {

		if(!isset($this->mimetype) || $force) {
			$this->mimetype = MimeTypeGetter::get($this->folder->getPath() . $this->filename);
		}
		return $this->mimetype;

	}
135430
public static function mime_type($file)  {
		$handle = finfo_open(FILEINFO_MIME);
		$mime_type = finfo_file($handle,$file);

		if (strpos($mime_type, ';')) {
			$mime_type = preg_replace('/;.*/', ' ', $mime_type);
		}

		return trim($mime_type);
	}
1117070
private function getType(string $file): string
	{
		$css = '/\.(css|less)$/';
		$js = '/\.js$/';

		if (preg_match($css, $file)) {
			return self::CSS;
		} elseif (preg_match($js, $file)) {
			return self::JS;
		}
		throw new InvalidArgumentException("Unknown assets file '$file'");
	}
484853
private function getMimeType($object, $file = null)
    {
        if (!is_null($file)) {
            $type = MimeTypes::getMimetype($file);
            if (!is_null($type)) {
                return $type;
            }
        }

        $type = MimeTypes::getMimetype($object);
        if (!is_null($type)) {
            return $type;
        }

        return self::DEFAULT_CONTENT_TYPE;
    }
860550
public function getMimeType(\SplFileInfo $file)
    {
        $fileInfo = finfo_open(FILEINFO_MIME_TYPE);
        $mimeType = finfo_file($fileInfo, $file->getPathname());
        finfo_close($fileInfo);

        return $mimeType;
    }
64169
public function fileMimeType($path)
    {
        $type = $this->mimeDetect->findType(strtolower(pathinfo($path, PATHINFO_EXTENSION)));
        if (!empty($type)) {
            return $type;
        }

        return 'unknown/type';
    }
1133284
protected function getFileRecord($file)
    {
        $result = null;
        $segment = implode('/', [DIRNAME_GEOLOCATION, $this->geolocator->getGeolocatorHandle(), $file]);
        $fileLocator = $this->app->make(FileLocator::class);
        /* @var FileLocator $fileLocator */
        $package = $this->geolocator->getGeolocatorPackage();
        if ($package !== null) {
            $fileLocator->addPackageLocation($package->getPackageHandle());
        }

        return $fileLocator->getRecord($segment);
    }
1240231
protected static function attachment_mime($file)
	{
		static $mimes = false;

		if ( ! $mimes)
		{
			$mimes = \Config::load('mimes');
		}

		$ext = pathinfo($file, PATHINFO_EXTENSION);

		$mime = \Arr::get($mimes, $ext, 'application/octet-stream');
		is_array($mime) and $mime = reset($mime);

		return $mime;
	}
1266607
protected function getMimeType($file)
    {
        $info = finfo_open(FILEINFO_MIME_TYPE);
        $mime = finfo_file($info, $file);
        finfo_close($info);

        return $mime;
    }
1093104
public static function guessMimeTypeFromFilename(string $file, string $default = self::MIMETYPE_DEFAULT): string
    {
        $file = \strtolower($file);
        
        if (($pos = \strrpos($file, '.')) !== false) {
            $file = \substr($file, $pos + 1);
        }
        
        if (\array_key_exists($file, self::$mimeTypes)) {
            return self::$mimeTypes[$file];
        }
        
        return $default;
    }
821161
function mediaType( $file ) {

		$mime = static::mimeType( $file );
		$mime = explode( ';', $mime );
		$mime = trim( $mime[0] );

		return $mime;
	}
1243244
public static function getMimeType($file) {
    $defaultType = 'application/octet-stream';
    if (class_exists('\FileInfo')) {
      // use extension
      $fileInfo = new finfo(FILEINFO_MIME);
      $fileType = $fileInfo->file(file_get_contents($file));
    }
    else {
      // try detect image mime type
      $imageInfo = @getimagesize($file);
      $fileType = isset($imageInfo['mime']) ? $imageInfo['mime'] : '';
    }
    return (is_string($fileType) && !empty($fileType)) ? $fileType : $defaultType;
  }
636340
protected static function _findMimeType($mimeType) {
        if ($mimeType instanceof File) {
            $mimeType = $mimeType->type();

        } else if (strpos($mimeType, '/') === false) {
            $mimeType = self::getTypeFromExt($mimeType);
        }

        return $mimeType;
    }
1017421
public static function getFile( $file ) {
		$file = Storage::getFile( Route::DOCUMENT_ROOT() . 'app/config/' . $file . '.json' );
		$out  = Parser::json( $file );

		return $out;
	}
698108
private function getMimeType($file)
    {
        $type = FileInfo::DIRECTORY_MIME_TYPE;
        if (is_file($file)) {
            if (class_exists('finfo')) {
                $finfo = new \finfo(FILEINFO_MIME);
                $type = $finfo->file($file);
            } else {
                $type = MimeType::getTypeByExt(pathinfo($file, PATHINFO_EXTENSION));
            }
        }
        $type = strstr($type, ';', true) ?: $type;

        return isset(MimeType::$internalType[$type]) ? MimeType::$internalType[$type] : $type;
    }
734158
protected function getFile($file)
    {
        $mapping = [
            '%environment%' => $this->runtime->getEnvironment(),
        ];

        if ($this->runtime->getHostName() !== null) {
            $mapping['%host%'] = $this->runtime->getHostName();
        }

        if ($this->runtime->getReleaseId() !== null) {
            $mapping['%release%'] = $this->runtime->getReleaseId();
        }

        $options = $this->getOptions();
        return str_replace(
            array_keys($mapping),
            array_values($mapping),
            $options[$file]
        );
    }