The UploadDataInput object.
A cancelable and resumable task exposing result promise from result
property.
service: S3Exception - thrown when checking for existence of the object
validation: StorageValidationErrorCode - Validation errors.
// Upload a file to s3 bucket
await uploadData({ key, data: file, options: {
onProgress, // Optional progress callback.
} }).result;
// Cancel a task
const uploadTask = uploadData({ key, data: file });
//...
uploadTask.cancel();
try {
await uploadTask.result;
} catch (error) {
if(isCancelError(error)) {
// Handle error thrown by task cancelation.
}
}
// Pause and resume a task
const uploadTask = uploadData({ key, data: file });
//...
uploadTask.pause();
//...
uploadTask.resume();
//...
await uploadTask.result;
Upload data to specified S3 object. By default, it uses single PUT operation to upload if the data is less than 5MB. Otherwise, it uses multipart upload to upload the data. If the data length is unknown, it uses multipart upload.
Limitations: