Package | com.tuarua.firebase.storage |
Class | public class StorageReference |
Inheritance | StorageReference ![]() |
Property | Defined By | ||
---|---|---|---|
bucket : String [read-only] | StorageReference | ||
name : String [read-only] | StorageReference | ||
parent : StorageReference [read-only]
Creates a new StorageReference pointing to the parent of the current reference
or nil if this instance references the root location. | StorageReference | ||
path : String [read-only] | StorageReference | ||
root : StorageReference [read-only]
Creates a new StorageReference pointing to the root object. | StorageReference |
Method | Defined By | ||
---|---|---|---|
StorageReference(path:String = null, url:String = null, bucket:String = null, name:String = null, isRoot:Boolean = false)
Creates a StorageReference initialized at a child Firebase Storage location. | StorageReference | ||
child(path:String):StorageReference
Creates a new StorageReference pointing to a child object of the current reference. | StorageReference | ||
downloadUrl(listener:Function):void
Asynchronously retrieves a long lived download URL with a revokable token. | StorageReference | ||
getData(maxDownloadSizeBytes:Number = -1):DownloadTask
Asynchronously downloads the object at the StorageReference to a ByteArray in memory. | StorageReference | ||
getMetadata(listener:Function):void
Retrieves metadata associated with an object at the current path. | StorageReference | ||
Asynchronously uploads data to the currently specified FIRStorageReference. | StorageReference | ||
Asynchronously uploads a file to the currently specified FIRStorageReference. | StorageReference | ||
remove(listener:Function = null):void
Deletes the object at the current path. | StorageReference | ||
updateMetadata(metadata:StorageMetadata, listener:Function = null):void
Updates the metadata associated with an object at the current path. | StorageReference | ||
write(toFile:File):DownloadTask
Asynchronously downloads the object at the current path to a specified system filepath. | StorageReference |
bucket | property |
bucket:String
[read-only] public function get bucket():String
name | property |
name:String
[read-only] public function get name():String
parent | property |
parent:StorageReference
[read-only] Creates a new StorageReference pointing to the parent of the current reference or nil if this instance references the root location. For example: path = foo/bar/baz parent = foo/bar path = foo parent = (root) path = (root) parent = nil
public function get parent():StorageReference
path | property |
path:String
[read-only] public function get path():String
root | property |
root:StorageReference
[read-only] Creates a new StorageReference pointing to the root object.
public function get root():StorageReference
StorageReference | () | Constructor |
public function StorageReference(path:String = null, url:String = null, bucket:String = null, name:String = null, isRoot:Boolean = false)
Creates a StorageReference initialized at a child Firebase Storage location. for instance "path/to/object".
Parameterspath:String (default = null ) — A relative path from the root to initialize the reference with
| |
url:String (default = null ) — A gs:// or https:// URL to initialize the reference with.
| |
bucket:String (default = null )
| |
name:String (default = null )
| |
isRoot:Boolean (default = false )
|
child | () | method |
public function child(path:String):StorageReference
Creates a new StorageReference pointing to a child object of the current reference. path = foo child = bar newPath = foo/bar path = foo/bar child = baz newPath = foo/bar/baz All leading and trailing slashes will be removed, and consecutive slashes will be compressed to single slashes. For example: child = /foo/bar newPath = foo/bar child = foo/bar/ newPath = foo/bar child = foo///bar newPath = foo/bar
Parameters
path:String — Path to append to the current path.
|
StorageReference — A new StorageReference pointing to a child location of the current reference.
|
downloadUrl | () | method |
public function downloadUrl(listener:Function):void
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.
Parameters
listener:Function — Function to be called on completion.
The function is expected to have the following signature:
function callback(url:String, error:StorageError):void { } |
getData | () | method |
public function getData(maxDownloadSizeBytes:Number = -1):DownloadTask
Asynchronously downloads the object at the StorageReference to a ByteArray in memory. A ByteArray of the provided max size will be allocated, so ensure that the device has enough free memory to complete the download. For downloading large files, getFile may be a better option.
Parameters
maxDownloadSizeBytes:Number (default = -1 ) — The maximum size in bytes to download. If the download exceeds this size
the task will be cancelled and an error will be returned.
|
DownloadTask — A DownloadTask that can be used to monitor or manage the download.
|
getMetadata | () | method |
public function getMetadata(listener:Function):void
Retrieves metadata associated with an object at the current path.
Parameters
listener:Function — Function to be called on completion.
The function is expected to have the following signature:
function callback(metadata:StorageMetadata, error:StorageError):void { } |
putData | () | method |
public function putData(byteArray:ByteArray, metadata:StorageMetadata = null):UploadTask
Asynchronously uploads data to the currently specified FIRStorageReference. This is not recommended for large files, and one should instead upload a file from disk.
Parameters
byteArray:ByteArray — The ByteArray to upload.
| |
metadata:StorageMetadata (default = null ) — Optional StorageMetadata containing additional information (MIME type, etc.)
about the object being uploaded.
|
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 a file to the currently specified FIRStorageReference.
Parameters
file:File — A File to be uploaded.
| |
metadata:StorageMetadata (default = null ) — Optional StorageMetadata containing additional information (MIME type, etc.)
about the object being uploaded.
|
UploadTask — An instance of UploadTask, which can be used to monitor or manage the upload.
|
remove | () | method |
public function remove(listener:Function = null):void
Deletes the object at the current path.
Parameters
listener:Function (default = null ) — Optional
|
updateMetadata | () | method |
public function updateMetadata(metadata:StorageMetadata, listener:Function = null):void
Updates the metadata associated with an object at the current path.
Parameters
metadata:StorageMetadata — An StorageMetadata object with the metadata to update.
| |
listener:Function (default = null ) — Optional Function to be called on completion.
The function is expected to have the following signature:
function callback(error:StorageError):void { } |
write | () | method |
public function write(toFile:File):DownloadTask
Asynchronously downloads the object at the current path to a specified system filepath.
Parameters
toFile:File — A File representing the path the object should be downloaded to.
|
DownloadTask — An DownloadTask that can be used to monitor or manage the download.
|