Skip to main content

@std/bytes@1.0.4
Built and signed on GitHub Actions

Utilities to manipulate Uint8Arrays that are not built-in to JavaScript

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
a week ago (1.0.4)

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);
Built and signed on
GitHub Actions
View transparency log

Add Package

deno add jsr:@std/bytes

Import symbol

import * as bytes from "@std/bytes";

---- OR ----

Import directly with a jsr specifier

import * as bytes from "jsr:@std/bytes";

Add Package

npx jsr add @std/bytes

Import symbol

import * as bytes from "@std/bytes";

Add Package

yarn dlx jsr add @std/bytes

Import symbol

import * as bytes from "@std/bytes";

Add Package

pnpm dlx jsr add @std/bytes

Import symbol

import * as bytes from "@std/bytes";

Add Package

bunx jsr add @std/bytes

Import symbol

import * as bytes from "@std/bytes";