0

How to fetch updated list of blobs from azure, When a new file has been added to blob storage??

This is the code which fetches the blobs from azure-storage

blobService.listContainersSegmented(null, function (error, results) {
    if (error) {
        // List container error
    } else {
        for (var i = 0, container; container = results.entries[i]; i++) {
            // Deal with container object
        }
    }
});

Is there any Listener or Stream to get updated list when a new blob is added?

Please help me.

Thanks in advance.

  • Did you mean a blob trigger function?https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-storage-blob-trigger?tabs=javascript – George Chen Apr 21 '20 at 11:12

1 Answers1

0

Azure Storage originally didn't have any facility to see updates based on any events: you'd have to list and analyze every blob to determine this on your own (as described in this question and set of answers).

Now, Azure Event Grid provides this ability, and you may choose events for:

  • blobs created or replaced
  • blobs deleted

If you use hierarchical directories (e.g. ADLS on top of Azure Storage), you get even more options (such as renames, as well as directory-level events).

Event Grid events are consumable via Azure Functions, Logic Apps, or an HTTP listener.

More details are here.

David Makogon
  • 69,407
  • 21
  • 141
  • 189
  • To second what @DavidMakogon said, we use the the Blob events in Logic Apps all the time - it works great and is very easy to set up. One caveat: if you specify a container using the "Prefix filter", be sure to include a trailing '/' to specify a single container: "/blobServices/default/containers/{containername}/". Without it you may inadvertently specify multiple containers. – Joel Cochran Apr 21 '20 at 14:59