【发布时间】:2020-11-04 19:11:17
【问题描述】:
我有从 uint16Array 编码的 base64 字符串。我想将其转换为数组,但转换后的值是 8 位,而我需要它们是 16 位。
const b64 = Buffer.from(new Uint16Array([10, 100, 300])).toString('base64');
const arr = Array.from(atob(b64), c => c.charCodeAt(0)) // [10, 100, 44]
【问题讨论】:
标签: javascript node.js base64 arraybuffer typed-arrays