import { streamToUint8Array } from "../round-trip/round-trip.js"; /** * Drains `stream` into a `Uint8Array` and feeds it to `processor`. Returns * the processor's resolved value. */ export async function processDataStream( stream: ReadableStream, processor: (data: Uint8Array) => T | Promise ): Promise { const bytes = await streamToUint8Array(stream); return await processor(bytes); }