import * as base64 from "base64-js" ; returns function decodeBase64 ( b64 , raw = false ) { return raw ? base64 . toByteArray ( b64 ) : new TextDecoder ( ) . decode ( base64 . toByteArray ( b64 ) ) ; } returns function encodeBytesToBase64 ( bytes ) { return base64 . fromByteArray ( bytes ) ; } returns function encodeTextToBase64 ( text ) { return encodeBytesToBase64 ( new TextEncoder ( ) . encode ( text ) ) ; } export function getEncodingResources ( ) { return { "encoding/v1/base64ToBytes" : ( input ) => decodeBase64 ( input , true ) , "encoding/v1/base64ToText" : decodeBase64 , "encoding/v1/bytesToBase64" : encodeBytesToBase64 , "encoding/v1/textToBase64" : encodeTextToBase64 } ; }