Skip to content

Read/Write Files from Disk#

ใช้ Read/Write Files from Disk node เพื่ออ่านหรือเขียนไฟล์จาก/ไปยังเครื่องที่รัน n8n อยู่

Self-hosted n8n only

node นี้ใช้ได้เฉพาะกับ n8n แบบ self-hosted เท่านั้น

Operations#

  • Read File(s) From Disk: ใช้ operation นี้เพื่อดึงไฟล์หนึ่งไฟล์หรือหลายไฟล์จากเครื่องที่รัน n8n
  • Write File to Disk: ใช้ operation นี้เพื่อสร้างไฟล์ binary บนเครื่องที่รัน n8n

ดูรายละเอียดการตั้งค่าแต่ละ operation ได้ในหัวข้อด้านล่าง

Read File(s) From Disk#

ตั้งค่า operation นี้ด้วย parameter เหล่านี้:

  • File(s) Selector: กรอก path ของไฟล์ที่ต้องการอ่าน
    • ถ้าต้องการอ่านหลายไฟล์ ให้กรอก pattern ของ path โดยสามารถใช้ตัวอักษรพิเศษเหล่านี้:
      • *: ตรงกับอักขระใด ๆ ศูนย์ตัวหรือมากกว่า ยกเว้น path separator
      • **: ตรงกับอักขระใด ๆ ศูนย์ตัวหรือมากกว่า รวม path separator ด้วย
      • ?: ตรงกับอักขระใด ๆ ยกเว้น path separator หนึ่งตัว
      • []: ตรงกับอักขระใด ๆ ที่อยู่ในวงเล็บ ตัวอย่างเช่น [abc] จะตรงกับ a, b หรือ c เท่านั้น

ดูรายละเอียดเพิ่มเติมเกี่ยวกับ pattern ได้ที่ Picomatch's Basic globbing

Read File(s) From Disk options#

สามารถตั้งค่า option เพิ่มเติมได้ดังนี้:

  • File Extension: กรอกนามสกุลไฟล์ที่ต้องการให้แสดงใน output
  • File Name: กรอกชื่อไฟล์ที่ต้องการให้แสดงใน output
  • MIME Type: กรอก MIME type ของไฟล์ใน output ดูตัวอย่าง MIME type ได้ที่ Common MIME types
  • Put Output File in Field: กรอกชื่อ field ใน output data ที่จะเก็บไฟล์

Write File to Disk#

ตั้งค่า operation นี้ด้วย parameter เหล่านี้:

  • File Path and Name: กรอก path ปลายทาง ชื่อไฟล์ และนามสกุลไฟล์
  • Input Binary Field: กรอกชื่อ field ใน input data ที่จะเก็บไฟล์ binary

Write File to Disk options#

operation นี้จะมี option ให้เลือกเพียงอย่างเดียว คือ Append เลือกว่าจะเพิ่มข้อมูลเข้าไฟล์เดิม (เปิด) หรือสร้างไฟล์ใหม่แทน (ปิด)

Templates and examples#

Generate SQL queries from schema only - AI-powered

by Yulia

View template details
Talk to your SQLite database with a LangChain AI Agent 🧠💬

by Yulia

View template details
Breakdown Documents into Study Notes using Templating MistralAI and Qdrant

by Jimleuk

View template details
Browse Read/Write Files from Disk integration templates, or search all templates

File locations#

ถ้าคุณรัน n8n ใน Docker คำสั่งจะถูกรันใน container ของ n8n ไม่ใช่บน host ของ Docker

node นี้จะมองหาไฟล์โดยอิงจาก path ที่ติดตั้ง n8n แนะนำให้ใช้ absolute path เพื่อป้องกัน error