Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the url of blob from azure blob trigger

i am using azure blob triggers to identify when a container get updated. the trigger works fine. but it only returns the blob file as it is (like base 64 string). but how do i get the url for the blob file in this trigger.

function.js

{
  "disabled": false,
  "bindings": [
      {
          "name": "readText",
          "type": "blobTrigger",
          "direction": "in",
          "path": "pngs/{name}",
          "connection":"STORAGEConnectionString"
      }
  ]
}

index.js

context.log('Node.js Blob trigger function processed', context.bindings);
like image 989
pavithra rox Avatar asked Nov 08 '22 11:11

pavithra rox


1 Answers

You have to use context.bindingData:

  • To get your {name} variable do this:

context.bindingData.name;

  • To get full path (in your case 'pngs/{name}') do this:

context.bindingData.blobTrigger;

  • To get your blob uri do this:

context.bindingData.uri;

Hope it helps.

like image 128
AliMola Avatar answered Nov 14 '22 21:11

AliMola