file

package
v0.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2026 License: MIT Imports: 7 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

File node

Type: file
Category: Storage

Writes the payload to a file (optionally restricted to a root directory).

Behavior

This node is registered as file and runs as part of a workflow. Its exact runtime behavior is implemented in node.go; this document summarizes the editor-facing purpose and configuration contract.

Configuration

Field Type Default Description
appendNewline boolean false Append Newline — Append \n to every written payload
createDir boolean false Create Directory — Create missing parent directories (mkdir -p)
encoding string utf8 Encoding — base64/hex decode a string payload before writing
errorCatch boolean false Error Catch Port — Adds a dedicated "error" output port; a node failure emits msg.error={text,node,full} on it when wired, else the catch/problem-queue ladder applies
filename ``
filenameType string fixed Filename Source
overwriteFile string true If File Exists — true: overwrite (truncate); false: append to the file; delete: remove the file first, then write fresh

Implementation

  • node.go contains the executor, validation, schema, and registration.
  • editor.html contains the editor integration.
  • node_test.go, when present, contains behavioral tests.

Documentation

Overview

Package file contains the file node implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileConfig

type FileConfig struct {
	// Filename is the target path (fixed mode); with FilenameType "msg"
	// the message's filename property is used instead
	Filename string `json:"filename"`
	// FilenameType selects the filename source: "fixed" (default) | "msg"
	FilenameType string `json:"filenameType"`
	// AppendNewline appends \n to every written payload
	AppendNewline bool `json:"appendNewline"`
	// OverwriteFile: "true" (default) truncates, "false" appends,
	// "delete" removes the file first then writes fresh
	OverwriteFile string `json:"overwriteFile"`
	// CreateDir creates missing parent directories (mkdir -p)
	CreateDir bool `json:"createDir"`
	// Encoding decodes a string payload before writing:
	// "utf8" (default) | "base64" | "hex"
	Encoding string `json:"encoding"`
}

FileConfig holds configuration for the file (write) node — the Node-RED `file` equivalent.

type FileNode

type FileNode struct {
	*nodebase.BaseNode
	// contains filtered or unexported fields
}

FileNode writes the message payload to a file, then passes the message through with the resolved filename in Metadata.

func NewFileNode

func NewFileNode(node nodestore.NodeInterface, config *FileConfig, host nodebase.NodeHost) *FileNode

NewFileNode creates a new file (write) node

func (*FileNode) Execute

Execute writes the payload to the resolved filename and returns the input message with Metadata["filename"] set.

func (*FileNode) Validate

func (n *FileNode) Validate() error

Validate checks the file node configuration

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL