file

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 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.

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