Skip to main content
Version: Next

FileReadActivity

Category: File Operations Namespace: CMS.Plugin.FlowManagement.Domain.FlowBusiness.Activitys Base Class: ActionActivity Module: FlowManagement.Domain

Overview​

FileReadActivity is a node used to read file content in a flow. Inheriting from ActionActivity, it supports reading the content of a file at a specified path and writing the result to the flow context. This node supports configuring file access modes, share types, and buffer sizes, allowing flexible handling of various file reading scenarios.

Business Scenarios​

Applicable Scenarios​

  • Config Reading: Read configuration file content
  • Data Import: Read data files for processing
  • Log Analysis: Read log files for analysis
  • Template Loading: Read template files for content generation
  • File Validation: Read file content for validation

Role in the System​

FileReadActivity provides file reading capabilities in the LMES flow system:

  • Reads files in the local file system
  • Supports multiple file access modes
  • Writes file content to the flow context for subsequent nodes to use

Collaboration with Other Nodes​

  • FileWriteActivity: Used together to implement file read/write operations
  • TextTemplateActivity: Used after reading template files for template processing
  • CsvReadActivity: Use the dedicated node if reading CSV format

Configuration Instructions​

Basic Configuration​

Property NameTypeRequiredDefault ValueDescription
FilePathstringYes-File path
FileModeFileModeNoOpenFile mode
FileAccessFileAccessNoReadAccess type
FileShareFileShareNoNoneShare type
BufferSizeintNo1024Buffer size
FlowItemKeystringNo-Flow context key to write the result to

Configuration Details​

FilePath​

Description: The full path of the file to read. Notes: Supports absolute and relative paths; if the file does not exist, the node skips execution.

FileMode​

Description: Specifies the file open mode. Options: Open, OpenOrCreate, Create, CreateNew, Truncate, Append

FileAccess​

Description: Specifies the access type for the file. Options: Read, Write, ReadWrite

FileShare​

Description: Specifies the access type for other threads to the file. Options: None, Read, Write, ReadWrite, Delete, Inheritable

Flow Context​

Output Parameters​

Parameter NameTypeDescription
{FlowItemKey}stringThe read file content

Usage Examples​

Basic Example​

{
"Type": "FileReadActivity",
"Name": "Read Config File",
"Alias": "ReadConfig",
"FilePath": "C:\\Config\\settings.json",
"FlowItemKey": "ConfigContent_Value"
}

Complete Configuration Example​

{
"Type": "FileReadActivity",
"Name": "Read Data File",
"Alias": "ReadData",
"FilePath": "D:\\Data\\input.txt",
"FileMode": "Open",
"FileAccess": "Read",
"FileShare": "Read",
"BufferSize": 4096,
"FlowItemKey": "FileContent_Value"
}

Notes​

  • ⚠️ If the file does not exist, the node skips execution without throwing an exception
  • ⚠️ Reading large files may affect performance; consider adjusting BufferSize
  • ⚠️ Ensure the flow running account has file read permissions
  • 💡 The read content is stored in the flow context specified by FlowItemKey

Update History​

DateVersionDescription
2025-11-281.0Initial version

Last updated: 2025-11-28