index.js
function getObjectUrl (data) {
  let blob;

  if (typeof data === 'object' && data.constructor.name === 'Blob') {
    blob = data;
  } else if (typeof data === 'string') {
    blob = new Blob([getTextEncoder().encode(data).buffer], {
      type: 'application/octet-stream'
    });
  } else if (typeof data === 'object' && data.constructor && data.constructor.name === 'ArrayBuffer') {
    blob = new Blob([data], {
      type: 'application/octet-stream'
    });
  } else {
    throw new Error('in-browser-download: Data must either be a Blob, a string or an ArrayBuffer');
  }

  return URL.createObjectURL(blob);
}
function getObjectUrl (data) {
  let blob;

  if (typeof data === 'object' && data.constructor.name === 'Blob') {
    blob = data;
  } else if (typeof data === 'string') {
    blob = new Blob([getTextEncoder().encode(data).buffer], {
      type: 'application/octet-stream'
    });
  } else if (typeof data === 'object' && data.constructor && data.constructor.name === 'ArrayBuffer') {
    blob = new Blob([data], {
      type: 'application/octet-stream'
    });
  } else {
    throw new Error('in-browser-download: Data must either be a Blob, a string or an ArrayBuffer');
  }

  return URL.createObjectURL(blob);
}
function getObjectUrl ( data ) { let blob ; if ( typeof data === 'object' && data . constructor . name === 'Blob' ) { blob = data ; } else if ( typeof data === 'string' ) { blob = new Blob ( [ getTextEncoder ( ) . encode ( data ) . buffer ] , { type : 'application/octet-stream' } ) ; } else if ( typeof data === 'object' && data . constructor && data . constructor . name === 'ArrayBuffer' ) { blob = new Blob ( [ data ] , { type : 'application/octet-stream' } ) ; } else { throw new Error ( 'in-browser-download: Data must either be a Blob, a string or an ArrayBuffer' ) ; } return URL . createObjectURL ( blob ) ; }
Return an object URL based on the given data.

@param {string|Blob|ArrayBuffer} data

@returns {*}
Return an object URL based on the given data .