-
-
Save ferronrsmith/e5099c45803fb09eb22e1ac8f9e22068 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is a minimal Base64 encode/decode utility for Nashorn -> JavaScript | |
// Add error checking for data types as needed within encode or decode | |
var Base64 = { | |
decode: function (str) { | |
return new java.lang.String(java.util.Base64.decoder.decode(str)); | |
}, | |
encode: function (str) { | |
return java.util.Base64.encoder.encodeToString(str.bytes); | |
} | |
}; | |
print(Base64.decode(Base64.encode("Hello, World!"))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment