buffer.atob(data)


稳定性: 3 - 旧版的。改用 Buffer.from(data, 'base64')

¥Stability: 3 - Legacy. Use Buffer.from(data, 'base64') instead.

  • data <any> Base64 编码的输入字符串。

    ¥data <any> The Base64-encoded input string.

将 Base64 编码的数据字符串解码为字节,并使用 Latin-1 (ISO-8859-1) 将这些字节编码为字符串。

¥Decodes a string of Base64-encoded data into bytes, and encodes those bytes into a string using Latin-1 (ISO-8859-1).

data 可以是任何可以强制转换为字符串的 JavaScript 值。

¥The data may be any JavaScript-value that can be coerced into a string.

提供此函数只是为了与旧版 Web 平台 API 兼容,并且永远不应在新代码中使用,因为它们使用字符串来表示二进制数据,并且早于 JavaScript 中类型化数组的引入。对于使用 Node.js API 运行的代码,应使用 Buffer.from(str, 'base64')buf.toString('base64') 执行 Base64 编码字符串和二进制数据之间的转换。

¥This function is only provided for compatibility with legacy web platform APIs and should never be used in new code, because they use strings to represent binary data and predate the introduction of typed arrays in JavaScript. For code running using Node.js APIs, converting between base64-encoded strings and binary data should be performed using Buffer.from(str, 'base64') and buf.toString('base64').