Documentation
¶
Overview ¶
Package filein contains the fileIn node implementation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileInConfig ¶
type FileInConfig struct {
// Filename is the source 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"`
// Format selects the read mode: "utf8" (default, one string msg) |
// "lines" (one msg per line with parts metadata) | "stream" (one msg
// per 64KiB chunk) | "binary" (one []byte msg)
Format string `json:"format"`
// SendError emits an error message (Data {error: ...}) for a missing
// file instead of raising a catchable error
SendError bool `json:"sendError"`
}
FileInConfig holds configuration for the file in (read) node — the Node-RED `file in` equivalent.
type FileInNode ¶
FileInNode reads a file and emits its content. The "lines" and "stream" formats use the MessageExpander hook — Execute stashes the chunks on the instance and Expand tags them with parts metadata so a downstream join node can rebuild the file.
func NewFileInNode ¶
func NewFileInNode(node nodestore.NodeInterface, config *FileInConfig, host nodebase.NodeHost) *FileInNode
NewFileInNode creates a new file in (read) node
func (*FileInNode) Execute ¶
func (n *FileInNode) Execute(ctx context.Context, input nodestore.MessageInterface) (nodestore.MessageInterface, error)
Execute reads the resolved file. For single-message formats the content lands in Data directly; for "lines"/"stream" it is stashed for Expand.
func (*FileInNode) Expand ¶
func (n *FileInNode) Expand(output nodestore.MessageInterface) []nodestore.MessageInterface
Expand turns the stashed lines/stream chunks into one message per part, tagged with parts {id, type, index, count, ch} so a join node can reassemble the file.
func (*FileInNode) Validate ¶
func (n *FileInNode) Validate() error
Validate checks the file in node configuration