Skip to content

二进制数据#

¥Binary data

二进制数据是指任何文件类型的数据,例如图片文件或文档。

¥Binary data is any file-type data, such as image files or documents.

此页面收集了与 n8n 中的二进制数据相关的资源。

¥This page collects resources relating to binary data in n8n.

在工作流中使用二进制数据#

¥Working with binary data in your workflows

你可以在 n8n 工作流中处理二进制数据。n8n 提供了一些节点来帮助你处理二进制数据。你还可以使用代码。

¥You can process binary data in n8n workflows. n8n provides nodes to help you work with binary data. You can also use code.

节点#

¥Nodes

有三个关键节点专门用于处理二进制数据文件:

¥There are three key nodes dedicated to handling binary data files:

¥Read/Write Files from Disk to read and write files from/to the machine where n8n is running.

¥Convert to File to take input data and output it as a file.

  • 从文件提取 用于从二进制格式获取数据并将其转换为 JSON。

¥Extract From File to get data from a binary format and convert it to JSON.

有单独的节点用于处理 XML 和 HTML 数据:

¥There are separate nodes for working with XML and HTML data:

以及用于执行常见任务的节点:

¥And nodes for performing common tasks:

¥Compression

¥Edit Image

你可以使用 本地文件触发器 根据本地文件的更改触发工作流。

¥You can trigger a workflow based on changes to a local file using the Local File trigger.

要拆分或连接二进制数据项,请使用 数据转换节点

¥To split or concatenate binary data items, use the data transformation nodes.

代码#

¥Code

你可以使用 代码节点 在工作流中操作二进制数据。例如,获取二进制数据缓冲区:获取工作流中可用的二进制数据。

¥You can use the Code node to manipulate binary data in your workflows. For example, Get the binary data buffer: get the binary data available in your workflow.

配置自托管时的二进制数据模式#

¥Configure binary data mode when self-hosting

你可以配置自托管的 n8n 实例如何使用 二进制数据环境变量 处理二进制数据。这包括设置存储路径和选择二进制数据存储方式等任务。

¥You can configure how your self-hosted n8n instance handles binary data using the Binary data environment variables. This includes tasks such as setting the storage path and choosing how to store binary data.

你的配置会影响 n8n 的扩展性:扩展 |二进制数据文件系统模式

¥Your configuration affects how well n8n scales: Scaling | Binary data filesystem mode.

读取和写入二进制文件可能存在安全隐患。如果你想禁用二进制数据的读写,请使用 NODES_EXCLUDE 环境变量。有关更多信息,请参阅 环境变量 |节点

¥Reading and writing binary files can have security implications. If you want to disable reading and writing binary data, use the NODES_EXCLUDE environment variable. Refer to Environment variables | Nodes for more information.