Ftext
Bun

function

stream.consumers.text

function text(
stream: ReadableStream | AsyncIterable<any, any, any> | ReadableStream<any>
): Promise<string>;
import { text } from 'node:stream/consumers';
import { Readable } from 'node:stream';

const readable = Readable.from('Hello world from consumers!');
const data = await text(readable);
console.log(`from readable: ${data.length}`);
// Prints: from readable: 27
@returns

Fulfills with the contents of the stream parsed as a UTF-8 encoded string.

Referenced types

interface ReadableStream<R = any>