表示字节数组的不可变对象。
签名:
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。