Amplify JS API Documentation
    Preparing search index...

    Function downloadData

    • Parameters

      Returns DownloadDataWithPathOutput

    • Parameters

      Returns DownloadDataOutput

    • Download S3 object data to memory

      Parameters

      Returns DownloadDataWithPathOutput

      A cancelable task exposing result promise from result property.

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

      validation: StorageValidationErrorCode - Validation errors

      // Download a file from s3 bucket
      const { body, eTag } = await downloadData({ path, options: {
      onProgress, // Optional progress callback.
      } }).result;
      // Cancel a task
      const downloadTask = downloadData({ path });
      //...
      downloadTask.cancel();
      try {
      await downloadTask.result;
      } catch (error) {
      if(isCancelError(error)) {
      // Handle error thrown by task cancelation.
      }
      }
    • Parameters

      Returns DownloadDataOutput

      A cancelable task exposing result promise from result property.

      The key and accessLevel parameters are deprecated and may be removed in the next major version. Please use path instead.

      Download S3 object data to memory

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

      validation: StorageValidationErrorCode - Validation errors

      // Download a file from s3 bucket
      const { body, eTag } = await downloadData({ key, options: {
      onProgress, // Optional progress callback.
      } }).result;
      // Cancel a task
      const downloadTask = downloadData({ key });
      //...
      downloadTask.cancel();
      try {
      await downloadTask.result;
      } catch (error) {
      if(isCancelError(error)) {
      // Handle error thrown by task cancelation.
      }
      }