• Download S3 object data to memory

    Parameters

    Returns DownloadDataOutput

    A cancelable task exposing result promise from result property.

    Throws

    service: S3Exception - thrown when checking for existence of the object

    Throws

    validation: StorageValidationErrorCode - Validation errors

    Example

    // Download a file from s3 bucket
    const { body, eTag } = await downloadData({ key, data: file, options: {
    onProgress, // Optional progress callback.
    } }).result;

    Example

    // Cancel a task
    const downloadTask = downloadData({ key, data: file });
    //...
    downloadTask.cancel();
    try {
    await downloadTask.result;
    } catch (error) {
    if(isCancelError(error)) {
    // Handle error thrown by task cancelation.
    }
    }