2017-01-22 67 views

回答

8

atob和btoa在JavascriptCore中不受支持,但在Chrome调试器运行时运行,因为JS代码在调试时在Chrome中运行。有很多base64模块。 https://github.com/mathiasbynens/base64适合我。

1

我发现一些简单的方法为我工作,与节点相同的api。

安装缓冲器 yarn add buffer

用法: console.log(Buffer.from("Hello World").toString('base64')); console.log(Buffer.from("SGVsbG8gV29ybGQ=", 'base64').toString('ascii'));