node-red/packages/node_modules/@node-red/nodes/locales/zh-CN/storage/10-file.html

56 lines
3.3 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/html" data-help-name="file">
<p><code>msg.payload</code></p>
<h3>输入</h3>
<dl class="message-properties">
<dt class="optional">filename<span class="property-type">字符串</span></dt>
<dd>如果未在节点中配置则此可选属性可以设置文件名</dd>
</dl>
<h3>输出</h3>
<p>写入完成后输入消息将发送到输出端口</p>
<h3>详细</h3>
<p>每个消息的有效荷载将添加到文件的末尾可以选择在每个消息之间添加一个换行符\n</p>
<p>如果使用<code>msg.filename</code>使</p>
<p>可以将其配置为覆盖整个文件而不是在文件后添加段落例如在将二进制数据写入文件例如图像应使用此选项并且应禁用添加换行符的选项</p>
<p>可以从编码列表中指定写入文件的数据的编码</p>
<p>您可以将此节点配置为删除文件</p>
</script>
<script type="text/html" data-help-name="file in">
<p>以字符串或二进制缓冲区的形式读取文件的内容</p>
<h3>输入</h3>
<dl class="message-properties">
<dt class="optional">filename<span class="property-type">字符串</span></dt>
<dd>如果未在节点配置中设置该属性可以选择要读取的文件名</dd>
</dl>
<h3>输出</h3>
<dl class="message-properties">
<dt>payload <span class="property-type">字符串 | buffer</span></dt>
<dd>文件的内容可以是字符串也可以是二进制的buffer</dd>
<dt class="optional">filename <span class="property-type">字符串</span></dt>
<dd>如果未在节点配置中设置该属性可以选择要读取的文件名</dd>
</dl>
<h3>详细</h3>
<p>文件名应该是绝对路径否则将相对于Node-RED进程的工作目录</p>
<p>在Windows上可能需要使用转义路径分隔符例如<code>\\Users\\myUser</code></p>
<p>可以选择将文本文件拆分为几行每行输出一条消息或者将二进制文件拆分为较小的buffer块-块大小取决于操作系统但通常为64kLinux/Mac或41kWindows</p>
<p>当拆分为多条消息时每条消息将具有<code>parts</code></p>
<p>如果输出格式为字符串则可以从编码列表中指定输入数据的编码</p>
<p>应该使用Catch节点来捕获并处理错误</p>
</script>