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

std/bytes/mod.ts

Deno standard library
Go to Latest
The Standard Library has been moved to JSR. See the blog post for details.
import * as mod from "https://deno.land/std@0.220.1/bytes/mod.ts";

Provides helper functions to manipulate Uint8Array byte slices that are not included on the Uint8Array prototype.

import { concat } from "https://deno.land/std@0.220.1/bytes/concat.ts";

const a = new Uint8Array([0, 1, 2]);
const b = new Uint8Array([3, 4, 5]);
concat([a, b]); // Uint8Array(6) [ 0, 1, 2, 3, 4, 5 ]

Functions

Concatenate an array of Uint8Arrays.

Copy bytes from the src array to the dst array. Returns the number of bytes copied.

Returns true if the suffix array appears at the end of the source array, false otherwise.

Check whether binary arrays are equal to each other.

Returns true if the source array contains the needle array, false otherwise.

Returns the index of the first occurrence of the needle array in the source array, or -1 if it is not present.

Returns the index of the last occurrence of the needle array in the source array, or -1 if it is not present.

Returns a new Uint8Array composed of count repetitions of the source array.

Returns true if the prefix array appears at the start of the source array, false otherwise.