t-comm
Version:
专业、稳定、纯粹的工具库
26 lines (25 loc) • 854 B
TypeScript
/**
* 将 Base64 编码的字符串解码为原始字符串
* 支持 Unicode 字符(包括中文、emoji 等),兼容小程序环境
* @param str - Base64 编码的字符串
* @returns 解码后的原始字符串
* @example
* ```ts
* decode('SGVsbG8gV29ybGQ='); // 'Hello World'
* decode('5L2g5aW95LiW55WM'); // '你好世界'
* decode('8J+YgA=='); // '😀'
* ```
*/
export declare const decode: (str: string) => string;
/**
* Base64 解码的内部实现(小程序版本的 atob)
* 将 Base64 编码的字符串解码为 Latin1 字符串
* @param string - Base64 编码的字符串
* @returns 解码后的字符串
* @throws {TypeError} 当输入不是有效的 Base64 字符串时抛出错误
* @example
* ```ts
* innerDecode('SGVsbG8='); // 'Hello'
* ```
*/
export declare const innerDecode: (string: string) => string;