Reference
Represents a reference to a Google Cloud Storage object in React Native Firebase.
A reference can be used to upload and download storage objects, get/set storage object metadata, retrieve storage object download urls and delete storage objects.
Example 1
Get a reference to a specific storage path.
const ref = firebase.storage().ref('invertase/logo.png');
Example 2
Get a reference to a specific storage path on another bucket in the same firebase project.
const ref = firebase.storage().refFromURL('gs://other-bucket/invertase/logo.png');
Properties
name
</>The short name of this object, which is the last component of the full path. For example, if fullPath is 'full/path/image.png', name is 'image.png'.
name: string;
parent
</>A reference pointing to the parent location of this reference, or null if this reference is the root.
parent: Reference | null;
Methods
getDownloadURL
</>Fetches a long lived download URL for this object.
getDownloadURL(): Promise<string>;
getMetadata
</>Fetches metadata for the object at this location, if one exists.
getMetadata(): Promise<FullMetadata>;
list
</>List items (files) and prefixes (folders) under this storage reference.
list(options?: ListOptions): Promise<ListResult>;
listAll
</>List all items (files) and prefixes (folders) under this storage reference.
listAll(): Promise<ListResult>;
put
</>Puts data onto the storage bucket.
put(data: Blob | Uint8Array | ArrayBuffer, metadata?: SettableMetadata): Task;
putFile
</>Puts a file from local disk onto the storage bucket.
putFile(localFilePath: string, metadata?: SettableMetadata): Task;
putString
</>Puts a string on the storage bucket. Depending on the string type, set a StringFormat
type.
putString(data: string, format?: "raw" | "base64" | "base64url" | "data_url", metadata?: SettableMetadata): Task;
toString
</>Returns a gs:// URL for this object in the form gs://<bucket>/<path>/<to>/<object>
.
toString(): string;
updateMetadata
</>Updates the metadata for this reference object on the storage bucket.
updateMetadata(metadata: SettableMetadata): Promise<FullMetadata>;