Task
interface
Storage Task used for Uploading or Downloading files.
Example 1
Get a Upload Storage task to upload a string:
const string = '{ "foo": 1 }';
const task = firebase
.storage()
.ref('/foo/bar.json')
.putString(string);
Example 2
Get a Download Storage task to download a file:
const downloadTo = `${firebase.utils.FilePath.DOCUMENT_DIRECTORY}/bar.json`;
const task = firebase
.storage()
.ref('/foo/bar.json')
.writeToFile(downloadTo);
Properties
snapshot
</>Initial state of Task.snapshot is null
. Once uploading begins, it updates to a TaskSnapshot
object.
snapshot: null | TaskSnapshot;
Methods
catch
</>catch(onRejected: (a: NativeFirebaseError) => any): Promise<any>;
on
</>Task event handler called when state has changed on the task.
on(event: "state_changed", nextOrObserver?: TaskSnapshotObserver | null | (a: TaskSnapshot) => any, error?: (a: NativeFirebaseError) => any | null, complete?: () => void | null): () => void;
then
</>then(onFulfilled?: (a: TaskSnapshot) => any | null, onRejected?: (a: NativeFirebaseError) => any | null): Promise<any>;