Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get base64 from sound url in javascript

Tags:

javascript

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?

like image 788
Dile Avatar asked Jun 02 '26 20:06

Dile


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);
like image 104
Ben Taber Avatar answered Jun 04 '26 09:06

Ben Taber



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!