Bytes

Bytes

An immutable object representing an array of bytes.

Constructor

new Bytes()

Methods

isEqual(other)

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

Parameters:
Name Type Description
other

The Bytes object to compare against.

Returns:
Type Description

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

toBase64()

Returns the underlying bytes as a Base64-encoded string.

Returns:
Type Description

The Base64-encoded string created from the Bytes object.

toString()

Returns a string representation of the Bytes object.

Returns:
Type Description

A string representation of the Bytes object.

toUint8Array()

Returns the underlying bytes in a new Uint8Array.

Returns:
Type Description

The Uint8Array created from the Bytes object.

(static) fromBase64String(base64, subtype)

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

Parameters:
Name Type Default Description
base64

The Base64 string used to create the Bytes object.

subtype 0

Optional subtype value.

(static) fromUint8Array(array, subtype)

Creates a new Bytes object from the given Uint8Array.

Parameters:
Name Type Default Description
array

The Uint8Array used to create the Bytes object.

subtype 0

Optional subtype value.