mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 10:58:56 +00:00
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com> Co-authored-by: nektro <nektro@users.noreply.github.com>
400 B
400 B
name
| name |
|---|
| Convert a Node.js Readable to an Uint8Array |
To convert a Node.js Readable stream to an Uint8Array in Bun, you can create a new Response object with the stream as the body, then use bytes() to read the stream into an Uint8Array.
import { Readable } from "stream";
const stream = Readable.from(["Hello, ", "world!"]);
const buf = await new Response(stream).bytes();