deno.land / std@0.224.0 / streams / to_blob.ts

to_blob.ts
View Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.// This module is browser compatible.
/** * Converts a {@linkcode ReadableStream} of {@linkcode Uint8Array}s to a * {@linkcode Blob}. Works the same as {@linkcode Response.blob}. * * @example * ```ts * import { toBlob } from "https://deno.land/std@$STD_VERSION/streams/to_blob.ts"; * * const stream = ReadableStream.from([new Uint8Array(1), new Uint8Array(2)]); * await toBlob(stream); // Blob { size: 3, type: "" } * ``` */export async function toBlob( stream: ReadableStream<Uint8Array>,): Promise<Blob> { return await new Response(stream).blob();}
std

Version Info

Tagged at
6 months ago