Back to Firebase Js Sdk

StorageReference interface

docs-devsite/storage.storagereference.md

12.12.13.3 KB
Original Source

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 %}

StorageReference interface

Represents a reference to a Google Cloud Storage object. Developers can upload, download, and delete objects, as well as get/set object metadata.

<b>Signature:</b>

typescript
export interface StorageReference 

Properties

PropertyTypeDescription
bucketstringThe name of the bucket containing this reference's object.
fullPathstringThe full path of this object.
namestringThe 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'.
parentStorageReference | nullA reference pointing to the parent location of this reference, or null if this reference is the root.
rootStorageReferenceA reference to the root of this object's bucket.
storageFirebaseStorageThe FirebaseStorage instance associated with this reference.

Methods

MethodDescription
toString()Returns a gs:// URL for this object in the form <code>gs://<bucket>/<path>/<to>/<object></code>

StorageReference.bucket

The name of the bucket containing this reference's object.

<b>Signature:</b>

typescript
bucket: string;

StorageReference.fullPath

The full path of this object.

<b>Signature:</b>

typescript
fullPath: string;

StorageReference.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'.

<b>Signature:</b>

typescript
name: string;

StorageReference.parent

A reference pointing to the parent location of this reference, or null if this reference is the root.

<b>Signature:</b>

typescript
parent: StorageReference | null;

StorageReference.root

A reference to the root of this object's bucket.

<b>Signature:</b>

typescript
root: StorageReference;

StorageReference.storage

The FirebaseStorage instance associated with this reference.

<b>Signature:</b>

typescript
storage: FirebaseStorage;

StorageReference.toString()

Returns a gs:// URL for this object in the form gs://<bucket>/<path>/<to>/<object>

<b>Signature:</b>

typescript
toString(): string;

<b>Returns:</b>

string

The gs:// URL.