import { blob } from 'node:stream/consumers';
const dataBlob = new Blob(['hello world from consumers!']);
const readable = dataBlob.stream();
const data = await blob(readable);
console.log(`from readable: ${data.size}`);
// Prints: from readable: 27
function
stream.consumers.blob
@returns
Fulfills with a Blob containing the full contents of the stream.
Referenced types
interface ReadableStream<R = any>
interface Blob
Consume the blob as an ArrayBuffer
Consume as a Uint8Array, backed by an ArrayBuffer
Returns a readable stream of the blob's contents