Decodes a string of data which has been encoded using base-64 encoding.
Create a Buffer
for the given string with base-64 encoding and use Buffer.toString('binary')
to return the decoded string.
代码片段
const atob = str => Buffer.from(str, 'base64').toString('binary');
使用样例
atob('Zm9vYmFy'); // 'foobar'