🚨 Latest Research:Tanstack npm Packages Compromised in Ongoing Mini Shai-Hulud Supply-Chain Attack.Learn More
Socket
Book a DemoSign in
Socket

@xylabs/arraybuffer

Package Overview
Dependencies
Maintainers
5
Versions
431
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xylabs/arraybuffer

Base functionality used throughout XY Labs TypeScript/JavaScript libraries

Source
npmnpm
Version
5.0.91
Version published
Weekly downloads
7.2K
-7.94%
Maintainers
5
Weekly downloads
 
Created
Source

@xylabs/arraybuffer

logo

main-build npm-badge npm-downloads-badge jsdelivr-badge npm-license-badge codacy-badge codeclimate-badge snyk-badge socket-badge

Base functionality used throughout XY Labs TypeScript/JavaScript libraries

Reference

@xylabs/arraybuffer

Functions

FunctionDescription
equalArrayBuffersCompares two ArrayBuffers for byte-level equality.
isArrayBufferType guard that checks if a value is an ArrayBuffer instance.
isArrayBufferLikeType guard that checks if a value conforms to the ArrayBufferLike interface (has byteLength and slice).
toArrayBufferConverts a string, bigint, or ArrayBufferLike to an ArrayBufferLike, with optional zero-padding.
toUint8ArrayConverts a string, bigint, or ArrayBufferLike to a Uint8Array, with optional zero-padding.

functions

equalArrayBuffers

@xylabs/arraybuffer

function equalArrayBuffers(a1: ArrayBufferLike, a2: ArrayBufferLike): boolean;

Compares two ArrayBuffers for byte-level equality.

Parameters

ParameterTypeDescription
a1ArrayBufferLikeFirst buffer
a2ArrayBufferLikeSecond buffer

Returns

boolean

True if the buffers have the same length and identical bytes

isArrayBuffer

@xylabs/arraybuffer

Call Signature

function isArrayBuffer(value: unknown): value is ArrayBuffer;

Type guard that checks if a value is an ArrayBuffer instance.

Parameters

ParameterType
valueunknown

Returns

value is ArrayBuffer

Call Signature

function isArrayBuffer<T>(value: T): value is Extract<T, ArrayBuffer>;

Type guard that checks if a value is an ArrayBuffer instance.

Type Parameters

Type Parameter
T extends ArrayBuffer

Parameters

ParameterType
valueT

Returns

value is Extract<T, ArrayBuffer>

isArrayBufferLike

@xylabs/arraybuffer

Call Signature

function isArrayBufferLike(value: unknown): value is ArrayBufferLike;

Type guard that checks if a value conforms to the ArrayBufferLike interface (has byteLength and slice).

Parameters

ParameterType
valueunknown

Returns

value is ArrayBufferLike

Call Signature

function isArrayBufferLike<T>(value: T): value is Extract<T, ArrayBufferLike>;

Type guard that checks if a value conforms to the ArrayBufferLike interface (has byteLength and slice).

Type Parameters

Type Parameter
T extends ArrayBufferLike

Parameters

ParameterType
valueT

Returns

value is Extract<T, ArrayBufferLike>

toArrayBuffer

@xylabs/arraybuffer

Call Signature

function toArrayBuffer(
   value: undefined, 
   padLength?: number, 
   base?: number): undefined;

Converts a string, bigint, or ArrayBufferLike to an ArrayBufferLike, with optional zero-padding.

Parameters

ParameterTypeDescription
valueundefinedThe value to convert (hex string, bigint, or existing buffer)
padLength?numberMinimum byte length, left-padded with zeros if needed
base?numberNumeric base for string parsing (default 16)

Returns

undefined

The resulting ArrayBufferLike, or undefined if value is undefined

Call Signature

function toArrayBuffer(
   value: string | bigint | ArrayBufferLike, 
   padLength?: number, 
   base?: number): ArrayBufferLike;

Converts a string, bigint, or ArrayBufferLike to an ArrayBufferLike, with optional zero-padding.

Parameters

ParameterTypeDescription
valuestring | bigint | ArrayBufferLikeThe value to convert (hex string, bigint, or existing buffer)
padLength?numberMinimum byte length, left-padded with zeros if needed
base?numberNumeric base for string parsing (default 16)

Returns

ArrayBufferLike

The resulting ArrayBufferLike, or undefined if value is undefined

Call Signature

function toArrayBuffer(
   value: string | bigint | ArrayBufferLike | undefined, 
   padLength?: number, 
   base?: number): ArrayBufferLike | undefined;

Converts a string, bigint, or ArrayBufferLike to an ArrayBufferLike, with optional zero-padding.

Parameters

ParameterTypeDescription
valuestring | bigint | ArrayBufferLike | undefinedThe value to convert (hex string, bigint, or existing buffer)
padLength?numberMinimum byte length, left-padded with zeros if needed
base?numberNumeric base for string parsing (default 16)

Returns

ArrayBufferLike | undefined

The resulting ArrayBufferLike, or undefined if value is undefined

toUint8Array

@xylabs/arraybuffer

Call Signature

function toUint8Array(
   value: undefined, 
   padLength?: number, 
   base?: number): undefined;

Converts a string, bigint, or ArrayBufferLike to a Uint8Array, with optional zero-padding.

Parameters

ParameterTypeDescription
valueundefinedThe value to convert
padLength?numberMinimum byte length, left-padded with zeros if needed
base?numberNumeric base for string parsing (default 16)

Returns

undefined

The resulting Uint8Array, or undefined if value is undefined

Call Signature

function toUint8Array(
   value: string | bigint | ArrayBufferLike, 
   padLength?: number, 
   base?: number): Uint8Array;

Converts a string, bigint, or ArrayBufferLike to a Uint8Array, with optional zero-padding.

Parameters

ParameterTypeDescription
valuestring | bigint | ArrayBufferLikeThe value to convert
padLength?numberMinimum byte length, left-padded with zeros if needed
base?numberNumeric base for string parsing (default 16)

Returns

Uint8Array

The resulting Uint8Array, or undefined if value is undefined

Call Signature

function toUint8Array(
   value: string | bigint | ArrayBufferLike | undefined, 
   padLength?: number, 
   base?: number): Uint8Array<ArrayBufferLike> | undefined;

Converts a string, bigint, or ArrayBufferLike to a Uint8Array, with optional zero-padding.

Parameters

ParameterTypeDescription
valuestring | bigint | ArrayBufferLike | undefinedThe value to convert
padLength?numberMinimum byte length, left-padded with zeros if needed
base?numberNumeric base for string parsing (default 16)

Returns

Uint8Array<ArrayBufferLike> | undefined

The resulting Uint8Array, or undefined if value is undefined

Part of sdk-js

Maintainers

License

See the LICENSE file for license details

Credits

Made with 🔥 and ❄️ by XYLabs

Keywords

xylabs

FAQs

Package last updated on 01 Apr 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts