node.js - Azure 无服务器功能:不支持输入绑定 DataType“流”
问题描述
目标是在流中以 Azure HttpTrigger 多部分形式(带有文本文件)接收并将其通过管道传输到 Azure Blob 存储。在处理过程中,检查文件是否超过SIZE_LIMIT
(20 兆字节),然后中止上传。
function.js
试图这样设置
{
"bindings": [
{
"authLevel": "anonymous",
"type": "httpTrigger",
"direction": "in",
"name": "req",
"methods": ["post"],
"dataType": "stream",
"route": "myroute"
},
{
"type": "http",
"direction": "out",
"name": "res"
}
],
"disabled": false
}
但在调试中,我看到了变量req.body
Buffer 类型。我究竟做错了什么?甚至可以在 Azure Functions 中接收流吗?
解决方案
目前,Nodejs(非 C#)函数将传入内容读取为缓冲区是设计使然。
这是跟踪流支持的线程,但似乎没有进行中。我们可能必须根据我们的要求对缓冲区进行操作(转换为流等)。
推荐阅读
- javascript - 通过 Axios 从 Javascript 代码发布到 .net WebApi 时出现 Access-Control-Allow_Headers CORS 错误
- plantuml - PlantUML:禁用关系上的可见性图标
- c# - 如何检测鼠标是否在对象Unity C#上
- python - 如何将在 tensorflow 2 中训练的模型转换为 tensorflow 1 冻结图
- oracle - 使用 SSRS 2012 插入 oracle 数据库表
- python - 当 Django 身份验证函数尝试绑定到自定义身份验证函数时出现 TypeError
- django - 无法解决“create_order”的反向问题,未找到任何参数
- reactjs - 错误:请求失败,状态码为 400
- mysql - 排序结果和确定关节位置
- python - 如何获取脚本以读取文件、接受用户输入并显示来自用户输入的特定行