JavaScript 字符串转二进制 ArrayBuffer 代码详解
javascript/nstringtobuffer(str) {/n/t// 将字符串转为arraybuffer/n/treturn new Uint8Array(str.match(/[/da-f]{2}/gi).map(h=>parseInt(h,16))).buffer/n},/n/n/n这段代码输出的数据是二进制数据,转换为了'ArrayBuffer'类型。
原文地址: https://www.cveoy.top/t/topic/miKk 著作权归作者所有。请勿转载和采集!