Package version:

A BlobBatchClient allows you to make batched requests to the Azure Storage Blob service.

Constructors

Methods

  • Create multiple set tier operations to set the tier on a blob. The operation is allowed on a page blob in a premium storage account and on a block blob in a blob storage account (locally redundant storage only). A premium page blob's tier determines the allowed size, IOPS, and bandwidth of the blob. A block blob's tier determines Hot/Cool/Archive storage type. This operation does not update the blob's ETag. See set blob tier details. The operation(subrequest) will be authenticated and authorized with specified credential.See blob batch authorization details.

    Parameters

    • urls: {}

      The urls of the blob resource to delete.

      • credential: any

        Such as AnonymousCredential, StorageSharedKeyCredential or any credential from the @azure/identity package to authenticate requests to the service. You can also provide an object that implements the TokenCredential interface. If not specified, AnonymousCredential is used.

      • tier: AccessTier
      • Optionaloptions: BlobSetTierOptions

      Returns Promise<BlobBatchSubmitBatchResponse>

    • Create multiple set tier operations to set the tier on a blob. The operation is allowed on a page blob in a premium storage account and on a block blob in a blob storage account (locally redundant storage only). A premium page blob's tier determines the allowed size, IOPS, and bandwidth of the blob. A block blob's tier determines Hot/Cool/Archive storage type. This operation does not update the blob's ETag. See set blob tier details. The operation(subrequest) will be authenticated and authorized with specified credential.See blob batch authorization details.

      Parameters

      Returns Promise<BlobBatchSubmitBatchResponse>

    • Submit batch request which consists of multiple subrequests.

      Get blobBatchClient and other details before running the snippets. blobServiceClient.getBlobBatchClient() gives the blobBatchClient

      Example usage:

      import { DefaultAzureCredential } from "@azure/identity";
      import { BlobServiceClient, BlobBatch } from "@azure/storage-blob";

      const account = "<account>";
      const credential = new DefaultAzureCredential();
      const blobServiceClient = new BlobServiceClient(
      `https://${account}.blob.core.windows.net`,
      credential,
      );

      const containerName = "<container name>";
      const containerClient = blobServiceClient.getContainerClient(containerName);
      const blobBatchClient = containerClient.getBlobBatchClient();

      const batchRequest = new BlobBatch();
      await batchRequest.deleteBlob("<blob-url-1>", credential);
      await batchRequest.deleteBlob("<blob-url-2>", credential, {
      deleteSnapshots: "include",
      });
      const batchResp = await blobBatchClient.submitBatch(batchRequest);
      console.log(batchResp.subResponsesSucceededCount);

      Example using a lease:

      import { DefaultAzureCredential } from "@azure/identity";
      import { BlobServiceClient, BlobBatch } from "@azure/storage-blob";

      const account = "<account>";
      const credential = new DefaultAzureCredential();
      const blobServiceClient = new BlobServiceClient(
      `https://${account}.blob.core.windows.net`,
      credential,
      );

      const containerName = "<container name>";
      const containerClient = blobServiceClient.getContainerClient(containerName);
      const blobBatchClient = containerClient.getBlobBatchClient();
      const blobClient = containerClient.getBlobClient("<blob name>");

      const batchRequest = new BlobBatch();
      await batchRequest.setBlobAccessTier(blobClient, "Cool");
      await batchRequest.setBlobAccessTier(blobClient, "Cool", {
      conditions: { leaseId: "<lease-id>" },
      });
      const batchResp = await blobBatchClient.submitBatch(batchRequest);
      console.log(batchResp.subResponsesSucceededCount);

      Parameters

      Returns Promise<BlobBatchSubmitBatchResponse>