录音转base64编码
不过不知道对不对,最后log可能是太多一次性打印不出来,只能循环打印,readLen 长度为14866的转换后是uint8Array.length18645长度,试试上传华为云可不可以把
let buf = new ArrayBuffer(40960);// 500M
let readLen = fs.readSync(globalThis.fd, buf, { offset: 0 });
fs.read(globalThis.fd, buf).then((readLen) => {
console.log(`readLen:${readLen}`);
let dataview = new DataView(buf)
let uint8Array = new Uint8Array(readLen);
for(var i =0;i<uint8Array.length;i++){
uint8Array[i]=dataview.getUint8(i)
}
let that = new util.Base64Helper();
let result1 = that.encodeToStringSync(uint8Array);
for(var i =0;i<result1.length;i++){
console.log(i+":"+result1[i])
}
})
更多推荐
所有评论(0)