I spent a lot of time, but I did not find any javascript example or document about how can I set a path parameter of a blob path from Azure function. How can I set the {filename} of "path": "randomnum-container/{filename}", from the function inside?
function.json
{
"bindings": [
{
"authLevel": "anonymous",
"type": "httpTrigger",
"direction": "in",
"name": "req",
"methods": [
"get"
]
},
{
"type": "http",
"direction": "out",
"name": "res"
},
{
"type": "blob",
"name": "outputBlob",
"path": "randomnum-container/{filename}",
"connection": "randomnum_STORAGE",
"direction": "out"
}
],
"disabled": false
}
index.js
module.exports = async function (context, req) {
context.log('JavaScript HTTP trigger function processed a request.');
const max = 100;
const num = Math.floor(Math.random() * Math.floor(max));
// how to set outputBlob {filename} parameter?
// let's say I want to save every request to {num}.txt
context.res = {
status: 200,
body: {
"number": num
}
}
};