Replies: 2 comments
-
Did not try this myself, but maybe polyfilling helps: https://github.com/MaxArt2501/base64-js/blob/master/base64.js |
Beta Was this translation helpful? Give feedback.
0 replies
-
js= goja.New()
js.Set("btoa", func(call goja.FunctionCall) goja.Value {
return js.VM.ToValue(base64.RawStdEncoding.EncodeToString([]byte(call.Arguments[0].String())))
})
js.Set("atob", func(call goja.FunctionCall) goja.Value {
str, _ := base64.RawStdEncoding.DecodeString(call.Arguments[0].String())
return js.VM.ToValue(string(str))
}) maybe that way? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
ES5.1 supports atob & btoa. But goja doesn't support this functionality.
Is there other way to achieve base64 conversion. Please let me know.
Beta Was this translation helpful? Give feedback.
All reactions