docs-devsite/firestore_.bytes.md
Project: /docs/reference/js/_project.yaml Book: /docs/reference/_book.yaml page_type: reference
{% comment %} DO NOT EDIT THIS FILE! This is generated by the JS SDK team, and any local changes will be overwritten. Changes should be made in the source code at https://github.com/firebase/firebase-js-sdk {% endcomment %}
An immutable object representing an array of bytes.
<b>Signature:</b>
export declare class Bytes
| Method | Modifiers | Description |
|---|---|---|
| fromBase64String(base64) | <code>static</code> | Creates a new <code>Bytes</code> object from the given Base64 string, converting it to bytes. |
| fromJSON(json) | <code>static</code> | Builds a <code>Bytes</code> instance from a JSON object created by Bytes.toJSON()<!-- -->. |
| fromUint8Array(array) | <code>static</code> | Creates a new <code>Bytes</code> object from the given Uint8Array. |
| isEqual(other) | Returns true if this <code>Bytes</code> object is equal to the provided one. | |
| toBase64() | Returns the underlying bytes as a Base64-encoded string. | |
| toJSON() | Returns a JSON-serializable representation of this <code>Bytes</code> instance. | |
| toString() | Returns a string representation of the <code>Bytes</code> object. | |
| toUint8Array() | Returns the underlying bytes in a new <code>Uint8Array</code>. |
Creates a new Bytes object from the given Base64 string, converting it to bytes.
<b>Signature:</b>
static fromBase64String(base64: string): Bytes;
| Parameter | Type | Description |
|---|---|---|
| base64 | string | The Base64 string used to create the <code>Bytes</code> object. |
<b>Returns:</b>
Builds a Bytes instance from a JSON object created by Bytes.toJSON()<!-- -->.
<b>Signature:</b>
static fromJSON(json: object): Bytes;
| Parameter | Type | Description |
|---|---|---|
| json | object | a JSON object represention of a <code>Bytes</code> instance |
<b>Returns:</b>
an instance of Bytes if the JSON object could be parsed. Throws a FirestoreError if an error occurs.
Creates a new Bytes object from the given Uint8Array.
<b>Signature:</b>
static fromUint8Array(array: Uint8Array): Bytes;
| Parameter | Type | Description |
|---|---|---|
| array | Uint8Array | The Uint8Array used to create the <code>Bytes</code> object. |
<b>Returns:</b>
Returns true if this Bytes object is equal to the provided one.
<b>Signature:</b>
isEqual(other: Bytes): boolean;
| Parameter | Type | Description |
|---|---|---|
| other | Bytes | The <code>Bytes</code> object to compare against. |
<b>Returns:</b>
boolean
true if this Bytes object is equal to the provided one.
Returns the underlying bytes as a Base64-encoded string.
<b>Signature:</b>
toBase64(): string;
<b>Returns:</b>
string
The Base64-encoded string created from the Bytes object.
Returns a JSON-serializable representation of this Bytes instance.
<b>Signature:</b>
toJSON(): object;
<b>Returns:</b>
object
a JSON representation of this object.
Returns a string representation of the Bytes object.
<b>Signature:</b>
toString(): string;
<b>Returns:</b>
string
A string representation of the Bytes object.
Returns the underlying bytes in a new Uint8Array<!-- -->.
<b>Signature:</b>
toUint8Array(): Uint8Array;
<b>Returns:</b>
Uint8Array
The Uint8Array created from the Bytes object.