node-red/packages/node_modules/@node-red/nodes/locales/zh-TW/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>