Bytes class

表示字节数组的不可变对象。

签名:

export declare class Bytes 

方法

方法修饰符描述
来自Base64String(base64) static从给定的 Base64 字符串创建一个新的Bytes对象,并将其转换为字节。
fromUint8Array(数组) static从给定的 Uint8Array 创建一个新的Bytes对象。
是否等于(其他)如果此Bytes对象等于提供的对象,则返回 true。
toBase64()以 Base64 编码字符串形式返回基础字节。
toString()返回Bytes对象的字符串表示形式。
toUint8Array()返回新Uint8Array中的基础字节。

Bytes.fromBase64String()

从给定的 Base64 字符串创建一个新的Bytes对象,并将其转换为字节。

签名:

static fromBase64String(base64: string): Bytes;

参数

范围类型描述
64位基数细绳用于创建Bytes对象的 Base64 字符串。

返回:

字节

Bytes.fromUint8Array()

从给定的 Uint8Array 创建一个新的Bytes对象。

签名:

static fromUint8Array(array: Uint8Array): Bytes;

参数

范围类型描述
大批Uint8Array Uint8Array 用于创建Bytes对象。

返回:

字节

Bytes.isEqual()

如果此Bytes对象等于提供的对象,则返回 true。

签名:

isEqual(other: Bytes): boolean;

参数

范围类型描述
其他字节要比较的Bytes对象。

返回:

布尔值

如果此Bytes对象等于提供的对象,则为 true。

字节.toBase64()

以 Base64 编码字符串形式返回基础字节。

签名:

toBase64(): string;

返回:

细绳

Bytes对象创建的 Base64 编码字符串。

字节.toString()

返回Bytes对象的字符串表示形式。

签名:

toString(): string;

返回:

细绳

Bytes对象的字符串表示形式。

Bytes.toUint8Array()

返回新Uint8Array中的基础字节

签名:

toUint8Array(): Uint8Array;

返回:

Uint8Array

Bytes对象创建的 Uint8Array。