Storage Reference Metadata

Represents a stateful metadata information about single file.

let metadata = storage.ref('hello').metadata;

ref → StorageReference

Returns a storage reference associated with this metadata instance.

load({ optional }) → Promise<StorageReference>

Loads metadata for associated storage reference.

  • optional → Boolean (defaults to false)

If file does not exist and optional is false, load Promise rejects with an object not found error.

let metadata = storage.ref('hello').metadata;

metadata.isLoaded // → false

await metadata.load();

metadata.isLoaded // → true
metadata.exists // → true

update(object) → Promise<StorageReference>

Updates file metadata.

let metadata = storage.ref('hello').metadata;
await metadata.update({
  contentType: 'text/plain',
  customMetadata: {
    hello: 'world'
  }
});

State properties

  • isLoadingBoolean
  • isLoadedBoolean
  • isErrorBoolean
  • errorObject | null
  • existsBoolean | undefined

Metadata properties

  • rawObject
  • typeString
  • nameString
  • sizeNumber
  • contentTypeString
  • customMetadataObject
  • cacheControlString
  • contentDispositionString
  • contentEncodingString
  • contentLanguageString
  • bucketString
  • fullPathString
  • md5HashString
  • generationString
  • metagenerationString
  • createdAtDate
  • updatedAtDate

serialized → object

Returns json representation of most important properties.

Useful for debugging.