Options
All
  • Public
  • Public/Protected
  • All
Menu

Class BlobChangeFeedClient

Package version

Hierarchy

  • BlobChangeFeedClient

Index

Constructors

constructor

  • new BlobChangeFeedClient(url: string, credential?: StorageSharedKeyCredential | AnonymousCredential | TokenCredential, options?: StoragePipelineOptions): BlobChangeFeedClient
  • new BlobChangeFeedClient(url: string, pipeline: Pipeline): BlobChangeFeedClient
  • Creates an instance of BlobChangeFeedClient.

    Parameters

    • url: string

      A Client string pointing to Azure Storage blob service, such as "https://myaccount.blob.core.windows.net". You can append a SAS if using AnonymousCredential, such as "https://myaccount.blob.core.windows.net?sasString".

    • Optional credential: StorageSharedKeyCredential | AnonymousCredential | TokenCredential

      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.

    • Optional options: StoragePipelineOptions

      Optional. Options to configure the HTTP pipeline.

      Example using DefaultAzureCredential from @azure/identity:

      const account = "<storage account name>";
      
      const defaultAzureCredential = new DefaultAzureCredential();
      
      const blobChangeFeedClient = new BlobChangeFeedClient(
        `https://${account}.blob.core.windows.net`,
        defaultAzureCredential
      );

      Example using an account name/key:

      const account = "<storage account name>"
      const sharedKeyCredential = new StorageSharedKeyCredential(account, "<account key>");
      
      const blobChangeFeedClient = new BlobChangeFeedClient(
        `https://${account}.blob.core.windows.net`,
        sharedKeyCredential
      );

    Returns BlobChangeFeedClient

  • Creates an instance of BlobChangeFeedClient.

    Parameters

    Returns BlobChangeFeedClient

Methods

listChanges

  • Returns an async iterable iterator to list all the change feed events in the specified account.

    .byPage() returns an async iterable iterator to list the change feed events in pages.

    Example using for await syntax:

    let i = 1;
    for await (const event of blobChangeFeedClient.listChanges()) {
      console.log(`Event ${i++}, type: ${event.eventType}`);
    }

    Example using iter.next():

    let i = 1;
    const iter = blobChangeFeedClient.listChanges();
    let eventItem = await iter.next();
    while (!eventItem.done) {
      console.log(`Event ${i++}, type: ${eventItem.eventType}`);
      eventItem = await iter.next();
    }

    Example using byPage():

    // passing optional maxPageSize in the page settings
    let i = 1;
    for await (const eventPage of blobChangeFeedClient.listChanges().byPage({ maxPageSize: 20 })) {
      if (eventPage.events) {
        for (const event of eventPage.events) {
          console.log(`Event ${i++}, type: ${event.eventType}`);
        }
      }
    }

    Example using paging with a marker:

    let i = 1;
    let iterator = blobChangeFeedClient.listChanges().byPage({ maxPageSize: 2 });
    let eventPage = (await iterator.next()).value;
    
    if (eventPage.events) {
      for (const container of eventPage.events) {
        console.log(`Event ${i++}, type: ${event.eventType}`);
      }
    }
    
    // Gets next marker
    let marker = eventPage.continuationToken;
    // Passing next marker as continuationToken
    iterator = blobChangeFeedClient
      .listChanges()
      .byPage({ continuationToken: marker, maxPageSize: 10 });
    eventPage = (await iterator.next()).value;
    
    if (eventPage.events) {
      for (const container of eventPage.events) {
         console.log(`Event ${i++}, type: ${event.eventType}`);
      }
    }

    Parameters

    Returns PagedAsyncIterableIterator<BlobChangeFeedEvent, BlobChangeFeedEventPage>

    An asyncIterableIterator that supports paging.

Static fromConnectionString

  • fromConnectionString(connectionString: string, options?: StoragePipelineOptions): BlobChangeFeedClient
  • Creates an instance of BlobChangeFeedClient from connection string.

    Parameters

    • connectionString: string

      Account connection string or a SAS connection string of an Azure storage account. [ Note - Account connection string can only be used in NODE.JS runtime. ] Account connection string example - DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=accountKey;EndpointSuffix=core.windows.net SAS connection string example - BlobEndpoint=https://myaccount.blob.core.windows.net/;QueueEndpoint=https://myaccount.queue.core.windows.net/;FileEndpoint=https://myaccount.file.core.windows.net/;TableEndpoint=https://myaccount.table.core.windows.net/;SharedAccessSignature=sasString

    • Optional options: StoragePipelineOptions

      Optional. Options to configure the HTTP pipeline.

    Returns BlobChangeFeedClient

Generated using TypeDoc