Schaemelhout Schaemelhout - 9 months ago 58
Node.js Question

Saving multiple blobs with Azure Blob Storage output binding in Azure Function

I use the following code to add multiple messages to an Azure Storage Queue through an output binding on my Azure Function:

context.bindings.myQueue = [];
for (var msg of messages) {

This doesn't seem possible with a Blob output binding, I can store a blob using
context.bindings.myBlob = {...}
but I don't see a way to add multple blobs at once.

The data I'm trying to save to my Blob Storage is quite large so I would like to split it up into chunks and save them separately.

Is this possible through an output binding or would I have to use the azure-storage module to do this manually?

Answer Source

Multiple blob outputs for the same output binding are not currently supported. For now, your best option would be to pull in the storage module. If your input blobs are roughly the same size, another perhaps hacky option would be to define N static output bindings, and divide the blob into N chunks each time.

We do have an open issue for supporting dynamic bindings (issue here) which would address your scenario once that work is done. Basically we'll support the ability to imperatively create multiple output bindings in your code in Node.js, similar to the support we already have today for C# (detailed here).