BytesInstallation
Installation
How to install and import @visulima/bytes
Last updated:
Installation
Install the package using your preferred package manager:
bash npm install @visulima/bytes bash pnpm add @visulima/bytes bash yarn add @visulima/bytes bash bun add @visulima/bytes Import Methods
ESM (Recommended)
Import specific functions you need:
import { concat, equals, toUint8Array } from "@visulima/bytes";Import everything:
import * as bytes from "@visulima/bytes";
bytes.concat([...]);CommonJS
For CommonJS environments:
const { concat, equals, toUint8Array } = require("@visulima/bytes");Requirements
- Node.js: ≥22.13 ≤25.x
- TypeScript: ≥5.0 (optional, but recommended for type safety)
Verify Installation
Verify the package works correctly:
import { concat } from "@visulima/bytes";
const result = concat([new Uint8Array([1, 2]), new Uint8Array([3, 4])]);
console.log(result); // Uint8Array([1, 2, 3, 4])If you see the expected output, installation was successful!
TypeScript Support
The package includes full TypeScript type definitions. No additional @types packages are needed.
import type { Uint8ArrayList } from "@visulima/bytes";
import { concat } from "@visulima/bytes";
const arrays: Uint8Array[] = [new Uint8Array([1, 2]), new Uint8Array([3, 4])];
const result: Uint8Array = concat(arrays);