Helper functions for working with Uint8Array byte slices.
Uint8Array
import { concat, indexOfNeedle, endsWith } from "@std/bytes";import { assertEquals } from "@std/assert";const a = new Uint8Array([0, 1, 2]);const b = new Uint8Array([3, 4, 5]);const c = concat([a, b]);assertEquals(c, new Uint8Array([0, 1, 2, 3, 4, 5]));assertEquals(indexOfNeedle(c, new Uint8Array([2, 3])), 2);assertEquals(endsWith(c, b), true); Copy
import { concat, indexOfNeedle, endsWith } from "@std/bytes";import { assertEquals } from "@std/assert";const a = new Uint8Array([0, 1, 2]);const b = new Uint8Array([3, 4, 5]);const c = concat([a, b]);assertEquals(c, new Uint8Array([0, 1, 2, 3, 4, 5]));assertEquals(indexOfNeedle(c, new Uint8Array([2, 3])), 2);assertEquals(endsWith(c, b), true);
Helper functions for working with
Uint8Arraybyte slices.