Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

std/streams/to_blob.ts>toBlob

Deno standard library
Go to Latest
The Standard Library has been moved to JSR. See the blog post for details.
function toBlob
import { toBlob } from "https://deno.land/std@0.220.0/streams/to_blob.ts";

Converts a ReadableStream of Uint8Arrays to a Blob. Works the same as Response.blob.

Examples

Example 1

import { toBlob } from "https://deno.land/std@0.220.0/streams/to_blob.ts";

const stream = ReadableStream.from([new Uint8Array(1), new Uint8Array(2)]);
await toBlob(stream); // Blob { size: 3, type: "" }

Parameters

stream: ReadableStream<Uint8Array>

Returns

Promise<Blob>