表示位元組數組的不可變物件。
簽名:
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。