let arrayBuffer = new ArrayBuffer(100)
buffer.from(arrayBuffer).fill(1)
let arrayBuffer1 = arrayBuffer.slice(0,5)
buffer.from(arrayBuffer).fill(2)
console.log("treeli:::testBuffer =" + new Uint8Array(arrayBuffer))
console.log("treeli:::testBuffer =" + new Uint8Array(arrayBuffer1))
请参考链接:
https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/app-file-access-V5\#以流的形式读写文件
arraybuffer转Uint8Array请参考: