3

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
  • 1
    You can read it into a binary array .then convert the result to base64? Commented Jul 17, 2022 at 14:41

1 Answer 1

1
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);
Sign up to request clarification or add additional context in comments.

1 Comment

I'm mildly annoyed at your use of await :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.