gpt4 book ai didi

javascript - 以 Angular 将文件转换为 uInt8Array

转载 作者:行者123 更新时间:2023-12-01 23:27:34 25 4
gpt4 key购买 nike

<分区>

我想使用 golang api 将文件从 angular 上传到 postgresql。

在 Angular 部分,我想将我的文件转换为uInt8Array。我已经转换了数组,但它在我不知道的东西里面(如图所示)

screenshot-1

那么我怎样才能在像 let x : uInt8Array = y;

这样的变量中获取 uInt8Array

这是我尝试的程度。

x.component.html

<input (change)="onFileSelected($event)" type="file" id="fileUpload">

x.component.ts

onFileSelected(event) {
console.log("called");
const file: File = event.target.files[0];
if (file) {
console.log(file.arrayBuffer());
console.log("call finished");
}
}

输出在之前的截图中。

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com