index.js
function download (data, filename) {
  const element = getElement();
  const url = getObjectUrl(data);

  element.setAttribute('href', url);
  element.setAttribute('download', filename);
  document.body.appendChild(element);
  element.click();
  document.body.removeChild(element);

  setTimeout(function () {
    URL.revokeObjectURL(url);
  }, 100);
}
function download (data, filename) {
  const element = getElement();
  const url = getObjectUrl(data);

  element.setAttribute('href', url);
  element.setAttribute('download', filename);
  document.body.appendChild(element);
  element.click();
  document.body.removeChild(element);

  setTimeout(function () {
    URL.revokeObjectURL(url);
  }, 100);
}
function download ( data , filename ) { const element = getElement ( ) ; const url = getObjectUrl ( data ) ; element . setAttribute ( 'href' , url ) ; element . setAttribute ( 'download' , filename ) ; document . body . appendChild ( element ) ; element . click ( ) ; document . body . removeChild ( element ) ; setTimeout ( function ( ) { URL . revokeObjectURL ( url ) ; } , 100 ) ; }
Download a Blob, a string or an ArrayBuffer as a file in the browser

@param {string|ArrayBuffer} data The content of the file to download.
@param {string} [filename] The name of the file to download.
Download a Blob a string or an ArrayBuffer as a file in the browser