【发布时间】:2020-04-22 04:55:23
【问题描述】:
我花了很多时间,但我没有找到任何关于如何从 Azure 函数设置 blob 路径的路径参数的 javascript 示例或文档。如何从函数内部设置"path": "randomnum-container/{filename}" 的{filename}?
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
}
}
};
【问题讨论】:
标签: javascript azure function blob