MD5 in cloudflare worker?

Excuse me if this has already been asked. I am new to server side javascript and I am trying to figure out how to do MD5 hashing using javascript from a cloudflare worker.

Check out the WebCrypto documentation, you want the digest method.

Thank you. How do I get the digest value as base64? All examples I found encode it as base 16 (hexadecimal)

JavaScript sucks at stuff like this but eventually I was able to figure out how to base 64 encode it.