Skip to main content
On this page

@std/bytes

Overview Jump to heading

Helper functions for working with Uint8Array byte slices.

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);

Add to your project Jump to heading

deno add jsr:@std/bytes

See all symbols in @std/bytes on

Did you find what you needed?

Privacy policy