private static function guessFromFileCommand(string $filename): string
    {
        $result = 'application/octet-stream';

        if (!self::isCommandAvailable('file')) {
            return $result;
        }

        $info = trim(shell_exec('file -bi '.escapeshellarg($filename)));

        return $info != '' ? $info : $result;
    }