ReadableStream to a Uint8Array, read its contents into an ArrayBuffer with Bun.readableStreamToArrayBuffer, then create a Uint8Array that points to the buffer.
bytes() method converts to a Uint8Array directly.
Bun.readableStreamToBytes(stream) does the same thing, but is deprecated in favor of stream.bytes().
See Bun’s other
ReadableStream conversion functions.