Get base64 from sound url in javascript

Viewed 35

I have a example sound url here: http://awexsoft.rf.gd/testing/test.mp3 and i want to make a base64 from this url. Is there anyway to do this?

1 Answers
const res = await fetch('http://awexsoft.rf.gd/testing/test.mp3');
const data = await res.arrayBuffer();

const b64 = btoa(String.fromCharCode(...new Uint8Array(data)));

console.log(b64);
Related