public static function fetch($file)
    {
        $url = 'http://www.freeformatter.com/mime-types-list.html';

        // no need to download again if csv present
        if (file_exists($file)) {
            return;
        }

        $filePointerCsv = fopen($file, 'wb');
        $fileHtml = \dirname(__FILE__, 2) . '/resources/mimes.html';

        if (!file_exists($fileHtml)) {
            $contents = file_get_contents($url);
            file_put_contents($fileHtml, $contents);
        } else {
            $contents = file_get_contents($fileHtml);
        }

        $contents = preg_replace('/(.*)<tbody>/is', '', $contents);

        $contents = preg_replace('/<\/tbody>.*/is', '', $contents);

        try {
            $xml = new DOMDocument();

            @$xml->loadHTML($contents);

            $trs = $xml->getElementsByTagName('tr');

            for ($i = 0; $i < $trs->length; $i++) {
                $tr = $trs->item($i);

                $tds = $tr->childNodes;

                $nodeName = $tds->item(0);
                $nodeMime = $tds->item(2);
                $nodeFile = $tds->item(4);

                $extText = ($nodeFile->textContent === 'N/A') ? null : str_replace('.', '', $nodeFile->textContent);

                $extensions = explode(',', $extText);

                $extension = \count($extensions) ? trim(array_pop($extensions)) : $extText;

                fputcsv($filePointerCsv,
                    [
                        $nodeMime->textContent,
                        $nodeName->textContent,
                        $extension,
                    ],
                    ',',
                    '"'
                );
            }
        } catch (Exception $e) {
        }

        fclose($filePointerCsv);
    }