8
n8n 中文网amn8n.com

无代码:将多个二进制文件转换为Base64

中级

这是一个自动化工作流,包含 8 个节点。主要使用 Set, SplitOut, Aggregate, Compression, HttpRequest 等节点。 无需自定义代码将多个二进制文件转换为Base64 JSON数组

前置要求
  • 可能需要目标 API 的认证凭证

分类

-
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "BuinUkUBR1JKQBbz",
  "meta": {
    "instanceId": "8981479cb588889c05b145eaed421551d37a4fff11ab279d3f4744a6577c6002"
  },
  "name": "无代码:将多个二进制文件转换为 Base64",
  "tags": [],
  "nodes": [
    {
      "id": "ab159fb7-fa70-43e2-bcf2-fc9928d4e334",
      "name": "开始",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        0,
        272
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "bf134357-6efe-45f8-a5c1-577fcd397902",
      "name": "解压演示网站",
      "type": "n8n-nodes-base.compression",
      "position": [
        448,
        272
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "36767516-08c4-43d0-b18d-83e58f833753",
      "name": "下载演示网站",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        224,
        272
      ],
      "parameters": {
        "url": "https://github.com/n8n-io/n8n-demo-website/archive/refs/heads/main.zip",
        "options": {
          "response": {
            "response": {
              "responseFormat": "file"
            }
          }
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "71498fdd-2ea1-4e42-8554-5244be68acbc",
      "name": "分离文件",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        672,
        272
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "$binary"
      },
      "typeVersion": 1
    },
    {
      "id": "011458d6-28a3-4a32-982a-2622eb85023d",
      "name": "将文件编码为 Base64",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        896,
        272
      ],
      "parameters": {
        "options": {
          "keepSource": "binary"
        },
        "operation": "binaryToPropery",
        "binaryPropertyName": "={{ $binary.keys()[0] }}"
      },
      "typeVersion": 1
    },
    {
      "id": "aa0ccbcc-a237-4107-b41f-413a8eece2b1",
      "name": "为文件添加路径",
      "type": "n8n-nodes-base.set",
      "position": [
        1120,
        272
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "5bf261ef-b89b-40d0-82d4-1dfef62b5c1d",
              "name": "path",
              "type": "string",
              "value": "={{ $binary[$binary.keys()[0]].directory ? $binary[$binary.keys()[0]].directory + '/' : ''}}{{ $binary[$binary.keys()[0]].fileName }}"
            },
            {
              "id": "3a05fbc1-31c6-4491-865b-3a5f59474f23",
              "name": "data",
              "type": "string",
              "value": "={{ $json.data }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "bae79c09-1977-4ed5-ac0f-5e668fbd62bf",
      "name": "聚合输出",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        1344,
        272
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData",
        "destinationFieldName": "files"
      },
      "typeVersion": 1
    },
    {
      "id": "bd118a52-fe0c-4a9f-89fa-44871859e832",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        -352
      ],
      "parameters": {
        "width": 1440,
        "height": 576,
        "content": "## 无代码:将多个二进制文件转换为 Base64"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "3a7d7269-81e0-4c71-a9c4-7f02076dd9fb",
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Download Demo Website",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out Files": {
      "main": [
        [
          {
            "node": "Encode Files to Base64",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add Path to Files": {
      "main": [
        [
          {
            "node": "Aggregate Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Unzip Demo Website": {
      "main": [
        [
          {
            "node": "Split Out Files",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Demo Website": {
      "main": [
        [
          {
            "node": "Unzip Demo Website",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Encode Files to Base64": {
      "main": [
        [
          {
            "node": "Add Path to Files",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

中级

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
中级
节点数量8
分类-
节点类型8
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

外部链接
在 n8n.io 查看

分享此工作流