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

to_array_buffer_test.ts
View Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import { assertEquals } from "../assert/assert_equals.ts";import { toArrayBuffer } from "./to_array_buffer.ts";
Deno.test("toArrayBuffer()", async () => { const stream = ReadableStream.from([ new Uint8Array([1, 2, 3, 4, 5]), new Uint8Array([6, 7]), new Uint8Array([8, 9]), ]);
const buf = await toArrayBuffer(stream); assertEquals(buf, new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9]).buffer);});
std

Version Info

Tagged at
6 months ago