Bytes class

An immutable object representing an array of bytes.

Signature:

export declare class Bytes 

Methods

Method Modifiers Description
fromBase64String(base64) static Creates a new Bytes object from the given Base64 string, converting it to bytes.
fromUint8Array(array) static Creates a new Bytes object from the given Uint8Array.
isEqual(other) Returns true if this Bytes object is equal to the provided one.
toBase64() Returns the underlying bytes as a Base64-encoded string.
toString() Returns a string representation of the Bytes object.
toUint8Array() Returns the underlying bytes in a new Uint8Array.

Bytes.fromBase64String()

Creates a new Bytes object from the given Base64 string, converting it to bytes.

Signature:

static fromBase64String(base64: string): Bytes;

Parameters

Parameter Type Description
base64 string The Base64 string used to create the Bytes object.

Returns:

Bytes

Bytes.fromUint8Array()

Creates a new Bytes object from the given Uint8Array.

Signature:

static fromUint8Array(array: Uint8Array): Bytes;

Parameters

Parameter Type Description
array Uint8Array The Uint8Array used to create the Bytes object.

Returns:

Bytes

Bytes.isEqual()

Returns true if this Bytes object is equal to the provided one.

Signature:

isEqual(other: Bytes): boolean;

Parameters

Parameter Type Description
other Bytes The Bytes object to compare against.

Returns:

boolean

true if this Bytes object is equal to the provided one.

Bytes.toBase64()

Returns the underlying bytes as a Base64-encoded string.

Signature:

toBase64(): string;

Returns:

string

The Base64-encoded string created from the Bytes object.

Bytes.toString()

Returns a string representation of the Bytes object.

Signature:

toString(): string;

Returns:

string

A string representation of the Bytes object.

Bytes.toUint8Array()

Returns the underlying bytes in a new Uint8Array.

Signature:

toUint8Array(): Uint8Array;

Returns:

Uint8Array

The Uint8Array created from the Bytes object.