Skip to main content

@std/bytes@0.215.0

latest
Works with
It is unknown whether this package works with Browsers, Deno, Node.js, Cloudflare Workers, Bun
It is unknown whether this package works with Browsers
It is unknown whether this package works with Deno
It is unknown whether this package works with Node.js
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Bun
JSR Score70%
Published2 years ago (0.215.0)
default

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

Functions

f
concat(buf: Uint8Array[]): Uint8Array

Concatenate an array of Uint8Arrays.

f
copy(
src: Uint8Array,
dst: Uint8Array,
off?
): number

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

f
endsWith(
source: Uint8Array,
suffix: Uint8Array
): boolean

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

f
equals(
a: Uint8Array,
b: Uint8Array
): boolean

Check whether binary arrays are equal to each other.

f
includesNeedle(
source: Uint8Array,
needle: Uint8Array,
start?
): boolean

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

f
indexOfNeedle(
source: Uint8Array,
needle: Uint8Array,
start?
): number

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

f
lastIndexOfNeedle(
source: Uint8Array,
needle: Uint8Array,
start?: number
): number

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

f
repeat(
source: Uint8Array,
count: number
): Uint8Array

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

f
startsWith(
source: Uint8Array,
prefix: Uint8Array
): boolean

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

concat

Functions

f
concat(buf: Uint8Array[]): Uint8Array

Concatenate an array of Uint8Arrays.

copy

Functions

f
copy(
src: Uint8Array,
dst: Uint8Array,
off?
): number

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

ends_with

Functions

f
endsWith(
source: Uint8Array,
suffix: Uint8Array
): boolean

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

equals

Functions

f
equals(
a: Uint8Array,
b: Uint8Array
): boolean

Check whether binary arrays are equal to each other.

includes_needle

Functions

f
includesNeedle(
source: Uint8Array,
needle: Uint8Array,
start?
): boolean

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

index_of_needle

Functions

f
indexOfNeedle(
source: Uint8Array,
needle: Uint8Array,
start?
): number

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

last_index_of_needle

Functions

f
lastIndexOfNeedle(
source: Uint8Array,
needle: Uint8Array,
start?: number
): number

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

repeat

Functions

f
repeat(
source: Uint8Array,
count: number
): Uint8Array

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

starts_with

Functions

f
startsWith(
source: Uint8Array,
prefix: Uint8Array
): boolean

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

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.