Go to console

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

Index

Properties

bucket

bucket: string

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

fullPath

fullPath: string

The full path of this object.

name

name: string

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

parent

parent: Reference | null

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

root

root: Reference

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

storage

storage: Storage

The storage service associated with this reference.

Methods

child

  • child(path: string): Reference
  • Returns a reference to a relative path from this reference.

    Parameters

    • path: string

      The relative path from this reference. Leading, trailing, and consecutive slashes are removed.

    Returns Reference

    The reference to the given path.

delete

  • delete(): Promise<any>
  • Deletes the object at this reference's location.

    Returns Promise<any>

    A Promise that resolves if the deletion succeeded and rejects if it failed, including if the object didn't exist.

getDownloadURL

  • getDownloadURL(): Promise<any>
  • Fetches a long lived download URL for this object.

    Returns Promise<any>

    A Promise that resolves with the download URL or rejects if the fetch failed, including if the object did not exist.

getMetadata

  • getMetadata(): Promise<any>
  • Fetches metadata for the object at this location, if one exists.

    Returns Promise<