@ivujs/i-utils
Version:
前端模块化 JavaScript 工具库
65 lines (56 loc) • 1.34 kB
JavaScript
;
var base64 = require('./base64.cjs');
/**
* base64 加密
* @param {String} str 字符串
* @returns {String} 返回加密后的字符串
*/
function encode(str) {
return base64.encode(str);
}
/**
* base64 解密
* @param {String} str 字符串
* @returns {String} 返回解密后的字符串
*/
function decode(str) {
return base64.decode(str);
}
/**
* base64 utf8加密
* @param {String} str 字符串
* @returns {String} 返回加密后的字符串
*/
function utf8Encode(str) {
return base64.utf8Encode(str);
}
/**
* base64 utf8解密
* @param {String} str 字符串
* @returns {String} 返回解密后的字符串
*/
function utf8Decode(str) {
return base64.utf8Decode(str);
}
/**
* base64 加密字节数组
* @param {Array} array 数组
* @returns {String} 返回加密后的字符串
*/
function encodeAsBytes(array) {
return base64.encode(array);
}
/**
* base64 解密字节数组
* @param {String} str 字符串
* @returns {Array} 返回解密后的字节数组
*/
function decodeAsBytes(str) {
return base64.decodeAsBytes(str);
}
exports.decode = decode;
exports.decodeAsBytes = decodeAsBytes;
exports.encode = encode;
exports.encodeAsBytes = encodeAsBytes;
exports.utf8Decode = utf8Decode;
exports.utf8Encode = utf8Encode;