For AI agents: the complete documentation index is available at /apps-plugin/docs/llms.txt, the full documentation bundle is available at /apps-plugin/docs/llms-full.txt, and this page is available as Markdown at /apps-plugin/docs/js-api/basic/base64ToArrayBuffer.md.

base64ToArrayBuffer

将 Base64 字符串转换为 ArrayBuffer。

扫码预览

扫码预览 base64ToArrayBuffer

支持版本

前端库版本不低于 0.1.0。

支持平台

平台支持情况
Android支持
iOS支持
PC支持
HarmonyOS支持

支持场景

场景支持情况
页面支持
卡片支持

调用方式

同步 API

base64ToArrayBuffer(base64: string): ArrayBuffer

入参

名称类型必填默认值约束说明
base64string是--需要解码的标准 Base64 字符串。

调用示例

import { base64ToArrayBuffer } from '@doubao-dev/framework/api';

const buffer = base64ToArrayBuffer('AQIDBA==');
console.log(Array.from(new Uint8Array(buffer))); // [1, 2, 3, 4]

返回值

解码后的二进制数据。

返回示例

{
  "byteLength": 4
}