从磁盘读取/写入文件(Read/Write Files from Disk)#
使用磁盘文件读写节点从运行 n8n 的机器读取和写入文件。
🌐 Use the Read/Write Files from Disk node to read and write files from/to the machine where n8n is running.
仅限自托管 n8n
此节点在 n8n 云端不可用。
操作(Operations)#
有关配置每个操作的节点的更多信息,请参阅以下章节。
🌐 Refer to the sections below for more information on configuring the node for each operation.
从磁盘读取文件(Read File(s) From Disk)#
使用以下参数配置此操作:
🌐 Configure this operation with these parameters:
- 文件选择器:输入你想要读取的文件路径。
- 要输入多个文件,请输入页面路径模式。你可以使用这些字符来定义路径模式:
*:匹配任意字符零次或多次,但不包括路径分隔符。**:匹配任意字符零次或多次,包括路径分隔符。?:匹配除路径分隔符之外的任意字符一次。[]:匹配括号内的任意字符。例如,[abc]会匹配字符a、b或c,而不会匹配其他任何字符。
- 要输入多个文件,请输入页面路径模式。你可以使用这些字符来定义路径模式:
有关这些字符及其预期行为的更多信息,请参阅 Picomatch 的基本 globbing 文档。
🌐 Refer to Picomatch's Basic globbing documentation for more information on these characters and their expected behavior.
从磁盘读取文件选项(Read File(s) From Disk options)#
你也可以使用这些选项来配置此操作:
🌐 You can also configure this operation with these Options:
- 文件扩展名:在节点输出中输入文件的扩展名。
- 文件名:在节点输出中输入文件的名称。
- MIME 类型:在节点输出中输入文件的 MIME 类型。有关文件扩展名及其 MIME 类型的列表,请参阅 常见 MIME 类型。
- 将输出文件放入字段:输入输出数据中用于存放文件的字段名称。
将文件写入磁盘(Write File to Disk)#
使用以下参数配置此操作:
🌐 Configure this operation with these parameters:
- 文件路径和名称:输入文件的存放位置、文件名称以及文件扩展名。
- 输入二进制字段:输入节点输入数据中将包含二进制文件的字段名称。
将文件写入磁盘选项(Write File to Disk options)#
你也可以使用这些选项来配置此操作:
🌐 You can also configure this operation with these Options:
此操作包括一个选项,即是将数据追加到现有文件(开启)还是创建新文件而不是追加到现有文件(关闭)。
🌐 This operation includes a single option, whether to Append data to an existing file instead of creating a new one (turned on) or to create a new file instead of appending to existing (turned off).
模板和示例(Templates and examples)#
}
文件位置(File locations)#
如果你在 Docker 中运行 n8n,则你的命令将在 n8n 容器中运行,而不是在 Docker 主机中运行。
🌐 If you run n8n in Docker, your command runs in the n8n container and not the Docker host.
此节点会根据 n8n 安装路径查找文件。n8n 建议使用绝对文件路径以防止任何错误。
🌐 This node looks for files relative to the n8n install path. n8n recommends using absolute file paths to prevent any errors.