UNPKG

@signumjs/util

Version:

Useful utilities and tools for building Signum Network applications

23 lines 1.09 kB
"use strict"; /** * Original work Copyright (c) 2018 PoC-Consortium * Modified work Copyright (c) 2019 Burst Apps Team */ Object.defineProperty(exports, "__esModule", { value: true }); exports.convertStringToBase64String = void 0; // FIXME: This implementation has security warnings! const js_base64_1 = require("js-base64"); /** * Converts/Encodes a String into Base64 (URI) encoded string. UTF-8 is supported. * Inverse function {@link convertBase64StringToString} * @param str The string to be converted * @param isURICompatible Determine whether the resulting string shall be URI compatible, or not. Default is `true` * @return {string} The Base64 String representing the input string. The string is already URI encoded, i.e. can be used directly in browsers * * @category conversion */ const convertStringToBase64String = (str, isURICompatible = true) => { return isURICompatible ? js_base64_1.Base64.encodeURI(str) : js_base64_1.Base64.encode(str); }; exports.convertStringToBase64String = convertStringToBase64String; //# sourceMappingURL=convertStringToBase64String.js.map