首页 > 解决方案 > 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.bodyBuffer 类型。我究竟做错了什么?甚至可以在 Azure Functions 中接收流吗?

标签: node.jsazurestreamazure-functionsazure-blob-storage

解决方案


目前,Nodejs(非 C#)函数将传入内容读取为缓冲区是设计使然。

这是跟踪流支持的线程,但似乎没有进行中。我们可能必须根据我们的要求对缓冲区进行操作(转换为流等)。


推荐阅读