convertBlobToBase64 = (blob) => new Promise((resolve, reject) => {
  const reader = new FileReader;
  reader.onerror = reject;
  reader.onload = () => {
    resolve(reader.result);
  };
  reader.readAsDataURL(blob);
});

onmessage = async function(oEvent) {
  const result = await convertBlobToBase64(oEvent.data);
  postMessage(result);
};