www.dextsolution.com
DEXTUPLOAD
X5
Product description > Azure Blob Storage file download

# Azure Blob Storage file download

Azure's Data Storage services include Blob Storage, Table Storage, Queue Storage, File Storage, and more. DEXTUploadX5 provides the ability to download files from the Blob Storage service.

In order for the DEXTUploadX5 product to download files from Azure Blob Storage, CORS settings must be configured for the Blob service of the account using the storage, as communication between different sources must be allowed. To use the upload and download features, you must allow the HEAD, GET, POST, PUT, and OPTIONS request methods, as well as the content-type, x-request-with, and x-ms-* request headers. When operating, be careful not to set the Allowed Origins property to the value '*''.

If anonymous access to the container is allowed

  You can download files using the single file download or multiple file download feature of DEXTUploadX5. When registering a virtual file, set the URL property to the URL of the file object in Azure Blob Storage.

  Files (Blobs) stored in the container can be accessed using the following address scheme.

      https://{account-name}.blob.core.windows.net/{container-name}/{blob-name}

      dx.addVirtualFile({ name: "bridge_509147.jpg", size: 509147, url: "https://photomanager.blob.core.windows.net/photos/bridge_509147.jpg" });
      dx.addVirtualFile({ name: "beach_239826.jpg", size: 239826, url: "https://photomanager.blob.core.windows.net/photos/beach_239826.jpg" });
      dx.addVirtualFile({ name: "cosmos (empty) 195779.jpg", size: 195779, url: "https://photomanager.blob.core.windows.net/photos/cosmos+%28empty%29+195779.jpg" });

Downloading using a shared access token

  In environments where anonymous access is not allowed, a shared access token must be used to download files directly from Azure Blob Storage. For security reasons, the shared access token is generated by the backend and passed to DEXTUploadX5.

  To download from Azure Blob Storage, set the download mode to ‘AZRBS’ and use the setAZRBSDownloadConfig method to provide the necessary settings.

      dx.setDownloadMode("AZRBS");
      dx.setAZRBSDownloadConfig({
          sasDownloadURL: "https://domain/path/get-download-sastoken"
      });
      dx.addVirtualFile({ name: "bridge_509147.jpg", size: 509147, url: "https://photomanager.blob.core.windows.net/photos/bridge_509147.jpg" });
      dx.addVirtualFile({ name: "beach_239826.jpg", size: 239826, url: "https://photomanager.blob.core.windows.net/photos/beach_239826.jpg" });
      dx.addVirtualFile({ name: "cosmos (empty) 195779.jpg", size: 195779, url: "https://photomanager.blob.core.windows.net/photos/cosmos+%28empty%29+195779.jpg" });

  sasDownloadURL is the URL for obtaining the shared access token.

  By implementing the steps to obtain the shared access token required for file download on the server side using the Azure Storage SDK appropriate for the platform, you can have DEXTUploadX5 handle only the file download process without exposing security information such as access keys.

  Examples are provided for Java Web Applications and ASP.NET environments to help you understand the process of obtaining a shared access token. Please refer to the provided examples for implementation.

  - For environments using Java and Maven, here's how to obtain the Azure SDK.

        <dependency>
            <groupId>com.azure</groupId>
            <artifactId>azure-storage-blob</artifactId>
            <version>12.x.x</version>
        </dependency>

  - How to obtain the Azure SDK for Java and Gradle environments

        implementation 'com.azure:azure-storage-blob:12.x.x'

  - How to obtain the Azure Storage SDK in an ASP.NET environment

    By installing the Azure.Storage.Blobs package using the NuGet package manager, you can obtain Azure.Identity.dll, Azure.Storage.Blobs.dll, Azure.Storage.Common.dll, and netstandard.dll.

  By setting the address of the object to be downloaded as the URL of the virtual file, the key value is separated from the address and the download operation is performed.

  When downloading files using a shared access token, it is not necessary to specify the Blob address in the url property. DEXTUploadX5 does not perform the download if the url property is empty, so only minimal information needs to be set in the url property. However, if this is done, the key value cannot be extracted from the url, so a function to generate the key must be set in the makeKey property. Here, the key refers to the Blob name.

      dx.setAZRBSDownloadConfig({
          ...
          // Blob name: component-name/file-name
          makeKey: item => `${item.controlId}/${item.name}`
      });

  Subsequent operations can be performed by using button binding or directly calling the download method, as with single file downloads or multiple file downloads.

Features
  - Supports resume functionality.
  - When downloading files from Azure Blob Storage, the progress rate displayed in the progress window may not be as natural as other download methods.
  - When viewing files using the Azure web console, the file size is not displayed in bytes. If the exact file size is unknown, the progress rate displayed in the download progress window may not be displayed correctly.