如何获取ArrayBuffer的Uint8Array?

问题遇到的现象和发生背景

img

问题相关代码,请勿粘贴截图
运行结果及报错内容
我的解答思路和尝试过的方法
我想要达到的结果

You have to pass the ArrayBuffer to the Uint8Array constructor

You cannot directly manipulate the contents of an ArrayBuffer; instead, you create one of the typed array objects or a DataView object which represents the buffer in a specific format, and use that to read and write the contents of the buffer.

new Uint8Array(arrayBuffer);

img

img

简单来说 就是再一次使用 new Uint8Array(把你图中的buffer数据放到这里) 输出的就是 Uint8Array

可参考https://blog.csdn.net/weixin_49012647/article/details/115053741