Skip to main content

Convert a Node.js Readable to an Uint8Array

还没翻译译自英文(bun.com)本页 2 段都还没译

To convert a Node.js Readable stream to a Uint8Array in Bun, create a Response with the stream as the body, then call bytes().

import { Readable } from "stream";
const stream = Readable.from(["Hello, ", "world!"]);
const buf = await new Response(stream).bytes();
Traducción © 2026 fanyi.dev · Original © 2026 the Bun project (LICENSE.md names no copyright holder) (MIT)