How can I remove the stream parameter from blob storage trigger azure function

Viewed 434

I have a blob trigger function. I actually don't need the blob stream in this function ( i just get some meta properties off it to send a URL to twilio). I was thinking especially for some larger blob files, this would help performance if it knew not to send the stream to the trigger? I tried just removing the parameter hoping for some dynamic binding. This didn't work, it just serialized the blog into a string and put it into the next parameter - blob name string. Is there any other configuration available to make this work as desired?

Update: here is my method signature

 [FunctionName("OutboundFax")]
        public static void Run([BlobTrigger("faxdocuments/{name}", Connection = "faxdocumentsAppSetting")]Stream faxBlob, string name, ILogger log)
{}
1 Answers

For this problem, there is a description about usage of parameters: Usage.

You can use the following parameter types for the triggering blob:

  • Stream
  • TextReader
  • string
  • Byte[]
  • A POCO serializable as JSON
  • ICloudBlob
  • CloudBlockBlob
  • CloudPageBlob
  • CloudAppendBlob

So almostly CloudBlockBlob is the type you want, only thing you need to note is need install storage SDK tehn you will be able to use the blob SDK method.

About why azure function default type is Stream, firstly in this usage there is a description:

it is preferable to use a Stream or CloudBlockBlob type. For more information, see Concurrency and memory usage later in this article.

And another reason may be the Stream type is more applicable, cause it could be other blob type, and in default don't need to install the SDK.

Related