title: How can I get MIME type from base64 String?
body: <p>My base64 String looks like <code>"UklGRkAdEQBXQVZFZm10IBIAAAABAAEAg..."</code>.
  I try to download this file by browser. So, </p>
  
  <ol>
  <li>I convert it to blob by function: </li>
  </ol>
  
  <pre><code>      b64toBlob: function(b64Data, sliceSize = 512) {
              let byteCharacters = atob(b64Data);
              let byteArrays = [];
              for (let offset = 0; offset &lt; byteCharacters.length; offset += sliceSize) {
                  let slice = byteCharacters.slice(offset, offset + sliceSize);
                  let byteNumbers = new Array(slice.length);
                  for (let i = 0; i &lt; slice.length; i++) {
                      byteNumbers[i] = slice.charCodeAt(i);
                  }
                  let byteArray = new Uint8Array(byteNumbers);
                  byteArrays.push(byteArray);
              }
              let blob = new Blob(byteArrays);
              return blob;
          }
  </code></pre>
  
  <ol start="2">
  <li>Create URL from blob by <code>URL.createObjectURL(this.b64toBlob(base64))</code></li>
  <li>Emulate click on <code>&lt;a&gt;</code> tag with created URL.</li>
  </ol>
  
  <p>Mozilla Firefox recognizes the type of file and offers to download file with correct extension and it's good, but Chrome offers to download txt file regardless the real file type and it's a problem.</p>
  
  <p>I can set the file type, when create a blob file, and Chrome will work correct, but I don`t know, how define correct MIME type from base64.</p>