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)
function concat
concat(buffers: Uint8Array[]): Uint8Array

Concatenate an array of byte slices into a single slice.

Examples

Basic usage

import { concat } from "@std/bytes/concat";
import { assertEquals } from "@std/assert";

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

assertEquals(concat([a, b]), new Uint8Array([0, 1, 2, 3, 4, 5]));

Parameters

buffers: Uint8Array[]

Array of byte slices to concatenate.

Return Type

A new byte slice containing all the input slices concatenated.

Add Package

deno add jsr:@std/bytes

Import symbol

import { concat } from "@std/bytes/concat";

---- OR ----

Import directly with a jsr specifier

import { concat } from "jsr:@std/bytes/concat";

Add Package

npx jsr add @std/bytes

Import symbol

import { concat } from "@std/bytes/concat";

Add Package

yarn dlx jsr add @std/bytes

Import symbol

import { concat } from "@std/bytes/concat";

Add Package

pnpm dlx jsr add @std/bytes

Import symbol

import { concat } from "@std/bytes/concat";

Add Package

bunx jsr add @std/bytes

Import symbol

import { concat } from "@std/bytes/concat";