asyncfinalize() { // Upload all files according to your strategy } }
constuploader = newMyUploader();
You must override the addFile method with the logic to upload the file.
You can also override the initialize and finalize methods to handle the upload session lifecycle.
Use the initialize method to prepare your uploader internal state (e.g. reset from a previous upload),
and the finalize method to, for example, perform a bulk upload of all files.
The Uploader class let you define your own file upload strategy.
There are two types of uploaders you can define:
Stateless Uploader
In case you don't need to tie the upload of one file to the upload of another, you can use a stateless uploader.
Define an
UploadHandler
function that takes aFile
and returns aPromise<string>
.Stateful Uploader
In case you need to create more complex upload strategies, you can extend the
Uploader
class.This is useful when you need to upload multiple files at once.
You must override the
addFile
method with the logic to upload the file.You can also override the
initialize
andfinalize
methods to handle the upload session lifecycle. Use theinitialize
method to prepare your uploader internal state (e.g. reset from a previous upload), and thefinalize
method to, for example, perform a bulk upload of all files.