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 ¶
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 ¶
func (n *FileNode) Execute(ctx context.Context, input nodestore.MessageInterface) (nodestore.MessageInterface, error)
Execute writes the payload to the resolved filename and returns the input message with Metadata["filename"] set.