The Firebase JS SDK is now in BETA!
This EAP site is no longer maintained. See the official Firebase Documentation site for the latest documentation and information about the Firebase JS SDK.

Home > @firebase/storage > UploadTask

UploadTask interface

Represents the process of uploading an object. Allows you to monitor and manage the upload.

Signature:

export interface UploadTask 

Properties

Property Type Description
snapshot UploadTaskSnapshot A snapshot of the current task state.

Methods

Method Description
cancel() Cancels a running task. Has no effect on a complete or failed task.
catch(onRejected) Equivalent to calling then(null, onRejected).
on(event, nextOrObserver, error, complete) Listens for events on this task.Events have three callback functions (referred to as next, error, and complete).If only the event is passed, a function that can be used to register the callbacks is returned. Otherwise, the callbacks are passed after the event.Callbacks can be passed either as three separate arguments or as the next, error, and complete properties of an object. Any of the three callbacks is optional, as long as at least one is specified. In addition, when you add your callbacks, you get a function back. You can call this function to unregister the associated callbacks.
pause() Pauses a currently running task. Has no effect on a paused or failed task.
resume() Resumes a paused task. Has no effect on a currently running or failed task.
then(onFulfilled, onRejected) This object behaves like a Promise, and resolves with its snapshot data when the upload completes.