Readable 流转换为 Uint8Array,你可以用该流作为主体创建一个新的 Response 对象,然后使用 bytes() 将流读取为 Uint8Array。
Readable 流转换为 Uint8Array,你可以用该流作为主体创建一个新的 Response 对象,然后使用 bytes() 将流读取为 Uint8Array。
import { Readable } from "stream";
const stream = Readable.from(["Hello, ", "world!"]);
const buf = await new Response(stream).bytes();