Packagecom.distriqt.extension.firebase.storage
Interfacepublic interface StorageReference extends flash.events.IEventDispatcher

Represents a reference to a Google Cloud Storage object. Developers can upload and download objects, get/set object metadata, and delete an object at a specified path.



Public Methods
 MethodDefined By
  
child(path:String):StorageReference
Returns a new instance of StorageReference pointing to a child location of the current reference.
StorageReference
  
Deletes the object at this StorageReference.
StorageReference
  
getBucket():String
Return the Google Cloud Storage bucket that holds this object.
StorageReference
  
getBytes(maxDownloadSizeBytes:int):DownloadTask
Asynchronously downloads the object from this StorageReference.
StorageReference
  
getDownloadUrl():Boolean
Asynchronously retrieves a long lived download URL with a revokable token.
StorageReference
  
getFile(destinationFile:File):DownloadTask
Asynchronously downloads the object at this StorageReference to a specified system filepath.
StorageReference
  
Retrieves metadata associated with an object at this StorageReference.
StorageReference
  
getName():String
Returns the short name of this object.
StorageReference
  
Returns a new instance of StorageReference pointing to the parent location or null if this instance references the root location.
StorageReference
  
getPath():String
Returns the full path to this object, not including the Google Cloud Storage bucket.
StorageReference
  
Returns a new instance of StorageReference pointing to the root location.
StorageReference
  
list(maxResults:int, pageToken:String = null):void
List the child items and prefixes in this reference.
StorageReference
  
listAll():void
List all the child items and prefixes in this reference by recursively performing list operations.
StorageReference
  
putBytes(data:ByteArray, metadata:StorageMetadata = null):UploadTask
Asynchronously uploads byte data to this StorageReference.
StorageReference
  
putFile(file:File, metadata:StorageMetadata = null):UploadTask
Asynchronously uploads from a content URI to this StorageReference.
StorageReference
Events
 Event Summary Defined By
   StorageReference
   StorageReference
   StorageReference
   StorageReference
   StorageReference
   StorageReference
Method Detail
child()method
public function child(path:String):StorageReference

Returns a new instance of StorageReference pointing to a child location of the current reference. All leading and trailing slashes will be removed, and consecutive slashes will be compressed to single slashes. For example:

   child = /foo/bar     path = foo/bar
   child = foo/bar/     path = foo/bar
   child = foo///bar    path = foo/bar

Parameters

path:String — The relative path from this reference.

Returns
StorageReference — The child StorageReference
deleteReference()method 
public function deleteReference():void

Deletes the object at this StorageReference.

getBucket()method 
public function getBucket():String

Return the Google Cloud Storage bucket that holds this object.

Returns
String — the bucket
getBytes()method 
public function getBytes(maxDownloadSizeBytes:int):DownloadTask

Asynchronously downloads the object from this StorageReference. A byte array will be allocated large enough to hold the entire file in memory. Therefore, using this method will impact memory usage of your process.

Parameters

maxDownloadSizeBytes:int — The maximum allowed size in bytes that will be allocated. Set this parameter to prevent out of memory conditions from occurring. If the download exceeds this limit, the task will fail

Returns
DownloadTask — A DownloadTask to monitor the download process
getDownloadUrl()method 
public function getDownloadUrl():Boolean

Asynchronously retrieves a long lived download URL with a revokable token. This can be used to share the file with others, but can be revoked by a developer in the Firebase Console if desired. This asynchronous process will result in either a StorageReferenceEvent.GET_DOWNLOAD_URL_SUCCESS on success or StorageReferenceEvent.GET_DOWNLOAD_URL_ERROR on failure.

Returns
Booleantrue if the retrieval of the download url started successfully and false if there was an error

See also

getFile()method 
public function getFile(destinationFile:File):DownloadTask

Asynchronously downloads the object at this StorageReference to a specified system filepath.

Parameters

destinationFile:File — A File representing the path the object should be downloaded to.

Returns
DownloadTask — A DownloadTask that can be used to monitor or manage the download.
getMetadata()method 
public function getMetadata():void

Retrieves metadata associated with an object at this StorageReference.

getName()method 
public function getName():String

Returns the short name of this object.

Returns
String — The name of this object
getParent()method 
public function getParent():StorageReference

Returns a new instance of StorageReference pointing to the parent location or null if this instance references the root location.

Returns
StorageReference — The parent StorageReference.
getPath()method 
public function getPath():String

Returns the full path to this object, not including the Google Cloud Storage bucket.

Returns
String — The path
getRoot()method 
public function getRoot():StorageReference

Returns a new instance of StorageReference pointing to the root location.

Returns
StorageReference — The root StorageReference.
list()method 
public function list(maxResults:int, pageToken:String = null):void

List the child items and prefixes in this reference.

Note: You must be using version 2 of the rules for your storage bucket in order to use the list functionality.

Parameters

maxResults:int — The maximum number of results to return
 
pageToken:String (default = null) — If continuing from a previous list call, provide the page token from the event to retrieve the next page of results.

listAll()method 
public function listAll():void

List all the child items and prefixes in this reference by recursively performing list operations. This may end in an error if there are a lot of objects.

Note: You must be using version 2 of the rules for your storage bucket in order to use the list functionality.

putBytes()method 
public function putBytes(data:ByteArray, metadata:StorageMetadata = null):UploadTask

Asynchronously uploads byte data to this StorageReference.

Parameters

data:ByteArray — The byte array to upload
 
metadata:StorageMetadata (default = null) — [optional] StorageMetadata containing additional information (MIME type, etc.) about the object being uploaded.

Returns
UploadTask — An instance of UploadTask which can be used to monitor or manage the upload.
putFile()method 
public function putFile(file:File, metadata:StorageMetadata = null):UploadTask

Asynchronously uploads from a content URI to this StorageReference.

Parameters

file:File — The source File of the upload.
 
metadata:StorageMetadata (default = null) — [optional] StorageMetadata containing additional information (MIME type, etc.) about the object being uploaded.

Returns
UploadTask — An instance of UploadTask which can be used to monitor or manage the upload.
Event Detail
storagereference:delete:error Event
Event Object Type: com.distriqt.extension.firebase.storage.events.StorageReferenceEvent
StorageReferenceEvent.type property = com.distriqt.extension.firebase.storage.events.StorageReferenceEvent.DELETE_ERROR

storagereference:delete:success Event  
Event Object Type: com.distriqt.extension.firebase.storage.events.StorageReferenceEvent
StorageReferenceEvent.type property = com.distriqt.extension.firebase.storage.events.StorageReferenceEvent.DELETE_SUCCESS

storagereference:getDownloadUrl:error Event  
Event Object Type: com.distriqt.extension.firebase.storage.events.StorageReferenceEvent
StorageReferenceEvent.type property = com.distriqt.extension.firebase.storage.events.StorageReferenceEvent.GET_DOWNLOAD_URL_ERROR

storagereference:getDownloadUrl:success Event  
Event Object Type: com.distriqt.extension.firebase.storage.events.StorageReferenceEvent
StorageReferenceEvent.type property = com.distriqt.extension.firebase.storage.events.StorageReferenceEvent.GET_DOWNLOAD_URL_SUCCESS

storagereference:getMetadata:error Event  
Event Object Type: com.distriqt.extension.firebase.storage.events.StorageReferenceEvent
StorageReferenceEvent.type property = com.distriqt.extension.firebase.storage.events.StorageReferenceEvent.GET_METADATA_ERROR

storagereference:getMetadata:success Event  
Event Object Type: com.distriqt.extension.firebase.storage.events.StorageReferenceEvent
StorageReferenceEvent.type property = com.distriqt.extension.firebase.storage.events.StorageReferenceEvent.GET_METADATA_SUCCESS