%dw 2.0
import dw::Crypto
import toBase64 from dw::core::Binaries
var emailChecksum = Crypto::MD5("achaval@gmail.com" as Binary)
var image = readUrl(log("https://www.gravatar.com/avatar/$(emailChecksum)"), "application/octet-stream")
output application/json
---
toBase64(image)
toBase64
toBase64(content: Binary): String
Transforms a binary value into a Base64 string.
Example
This example transforms a binary value into a Base64 encoded string. In this case, the binary value represents an image.