使用ES6语法进行Base64的编码和解码
2017-12-08 01:09
726 查看
ES6: base64解码
/** * ES6: base64解码 */ decodeBase64Content: function (base64Content) { let commonContent = base64Content.replace(/\s/g, '+'); commonContent = Buffer.from(commonContent, 'base64').toString(); return commonContent; }
ES6: base64编码
/** * ES6: base64编码 */ encodeBase64Content: function (commonContent) { let base64Content = Buffer.from(commonContent).toString('base64'); return base64Content; },
相关文章推荐
- 使用openssl进行base64编码 解码
- 使用 命令行进行 base64 编码和解码
- 使用 apache 对 字符串进行base64编码解码
- 使用window.btoa和window.atob来进行Base64编码和解码
- 使用 命令行进行 base64 编码和解码
- 使用PHP对图片进行base64编码和解码
- C# 使用base64对字符串进行编码和解码
- php使用base64_encode和base64_decode对数据进行编码和解码
- java 中使用base64编码和解码:
- 利用openssl进行base64的编码与解码
- 使用 URLDecoder 和 URLEncoder 对中文字符进行编码和解码
- 使用GTMBase64编码解码字符串
- 使用Microsoft XML Dom进行base64编码
- 使用base64对图片的二进制进行编码,使其可以利用ajax进行显示
- %25%37%DD 。。。上述形式不是乱码。 这是urlencoding。 你可以使用js内置的方法 encodeURIComponent进行编码, 而使用decodeURIComponent把上述形式再解码为普通字符
- 实用命令:利用openssl进行BASE64编码解码、md5/sha1摘要、AES/DES3加密解密
- 利用base64对图片进行编码及解码
- 使用GTMBase64编码解码字符串
- Python中进行Base64编码和解码
- 使用Java对UTF8URL进行编码解码以及进行编码方式的判断