
Security News
/Research
Popular node-ipc npm Package Infected with Credential Stealer
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.
@xylabs/arraybuffer
Advanced tools
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
@xylabs/arraybuffer
| Function | Description |
|---|---|
| equalArrayBuffers | Compares two ArrayBuffers for byte-level equality. |
| isArrayBuffer | Type guard that checks if a value is an ArrayBuffer instance. |
| isArrayBufferLike | Type guard that checks if a value conforms to the ArrayBufferLike interface (has byteLength and slice). |
| toArrayBuffer | Converts a string, bigint, or ArrayBufferLike to an ArrayBufferLike, with optional zero-padding. |
| toUint8Array | Converts a string, bigint, or ArrayBufferLike to a Uint8Array, with optional zero-padding. |
function equalArrayBuffers(a1: ArrayBufferLike, a2: ArrayBufferLike): boolean;
Compares two ArrayBuffers for byte-level equality.
| Parameter | Type | Description |
|---|---|---|
a1 | ArrayBufferLike | First buffer |
a2 | ArrayBufferLike | Second buffer |
boolean
True if the buffers have the same length and identical bytes
function isArrayBuffer(value: unknown): value is ArrayBuffer;
Type guard that checks if a value is an ArrayBuffer instance.
| Parameter | Type |
|---|---|
value | unknown |
value is ArrayBuffer
function isArrayBuffer<T>(value: T): value is Extract<T, ArrayBuffer>;
Type guard that checks if a value is an ArrayBuffer instance.
| Type Parameter |
|---|
T extends ArrayBuffer |
| Parameter | Type |
|---|---|
value | T |
value is Extract<T, ArrayBuffer>
function isArrayBufferLike(value: unknown): value is ArrayBufferLike;
Type guard that checks if a value conforms to the ArrayBufferLike interface (has byteLength and slice).
| Parameter | Type |
|---|---|
value | unknown |
value is ArrayBufferLike
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 Parameter |
|---|
T extends ArrayBufferLike |
| Parameter | Type |
|---|---|
value | T |
value is Extract<T, ArrayBufferLike>
function toArrayBuffer(
value: undefined,
padLength?: number,
base?: number): undefined;
Converts a string, bigint, or ArrayBufferLike to an ArrayBufferLike, with optional zero-padding.
| Parameter | Type | Description |
|---|---|---|
value | undefined | The value to convert (hex string, bigint, or existing buffer) |
padLength? | number | Minimum byte length, left-padded with zeros if needed |
base? | number | Numeric base for string parsing (default 16) |
undefined
The resulting ArrayBufferLike, or undefined if value is undefined
function toArrayBuffer(
value: string | bigint | ArrayBufferLike,
padLength?: number,
base?: number): ArrayBufferLike;
Converts a string, bigint, or ArrayBufferLike to an ArrayBufferLike, with optional zero-padding.
| Parameter | Type | Description |
|---|---|---|
value | string | bigint | ArrayBufferLike | The value to convert (hex string, bigint, or existing buffer) |
padLength? | number | Minimum byte length, left-padded with zeros if needed |
base? | number | Numeric base for string parsing (default 16) |
ArrayBufferLike
The resulting ArrayBufferLike, or undefined if value is undefined
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.
| Parameter | Type | Description |
|---|---|---|
value | string | bigint | ArrayBufferLike | undefined | The value to convert (hex string, bigint, or existing buffer) |
padLength? | number | Minimum byte length, left-padded with zeros if needed |
base? | number | Numeric base for string parsing (default 16) |
ArrayBufferLike | undefined
The resulting ArrayBufferLike, or undefined if value is undefined
function toUint8Array(
value: undefined,
padLength?: number,
base?: number): undefined;
Converts a string, bigint, or ArrayBufferLike to a Uint8Array, with optional zero-padding.
| Parameter | Type | Description |
|---|---|---|
value | undefined | The value to convert |
padLength? | number | Minimum byte length, left-padded with zeros if needed |
base? | number | Numeric base for string parsing (default 16) |
undefined
The resulting Uint8Array, or undefined if value is undefined
function toUint8Array(
value: string | bigint | ArrayBufferLike,
padLength?: number,
base?: number): Uint8Array;
Converts a string, bigint, or ArrayBufferLike to a Uint8Array, with optional zero-padding.
| Parameter | Type | Description |
|---|---|---|
value | string | bigint | ArrayBufferLike | The value to convert |
padLength? | number | Minimum byte length, left-padded with zeros if needed |
base? | number | Numeric base for string parsing (default 16) |
Uint8Array
The resulting Uint8Array, or undefined if value is undefined
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.
| Parameter | Type | Description |
|---|---|---|
value | string | bigint | ArrayBufferLike | undefined | The value to convert |
padLength? | number | Minimum byte length, left-padded with zeros if needed |
base? | number | Numeric base for string parsing (default 16) |
Uint8Array<ArrayBufferLike> | undefined
The resulting Uint8Array, or undefined if value is undefined
Part of sdk-js
See the LICENSE file for license details
FAQs
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
The npm package @xylabs/arraybuffer receives a total of 14,059 weekly downloads. As such, @xylabs/arraybuffer popularity was classified as popular.
We found that @xylabs/arraybuffer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?

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.

Security News
/Research
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.

Security News
TeamPCP and BreachForums are promoting a Shai-Hulud supply chain attack contest with a $1,000 prize for the biggest package compromise.

Security News
Packagist urges PHP projects to update Composer after a GitHub token format change exposed some GitHub Actions tokens in CI logs.