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
UploadHandlerfunction that takes aFileand returns aPromise<string>.Stateful Uploader
In case you need to create more complex upload strategies, you can extend the
Uploaderclass.This is useful when you need to upload multiple files at once.
You must override the
addFilemethod with the logic to upload the file.You can also override the
initializeandfinalizemethods to handle the upload session lifecycle. Use theinitializemethod to prepare your uploader internal state (e.g. reset from a previous upload), and thefinalizemethod to, for example, perform a bulk upload of all files.