import { bytes } from 'node:stream/consumers';
import { Readable } from 'node:stream';
import { Buffer } from 'node:buffer';
const dataBuffer = Buffer.from('hello world from consumers!');
const readable = Readable.from(dataBuffer);
const data = await bytes(readable);
console.log(`from readable: ${data.length}`);
// Prints: from readable: 27
function
stream.consumers.bytes
): Promise<NonSharedUint8Array>;
@returns
Fulfills with a Uint8Array containing the full contents of the stream.