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 Name | Type | Required | Default Value | Description |
|---|---|---|---|---|
| FilePath | string | Yes | - | File path |
| FileMode | FileMode | No | Open | File mode |
| FileAccess | FileAccess | No | Read | Access type |
| FileShare | FileShare | No | None | Share type |
| BufferSize | int | No | 1024 | Buffer size |
| FlowItemKey | string | No | - | 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 Name | Type | Description |
|---|---|---|
| {FlowItemKey} | string | The 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
Related Nodes
- FileWriteActivity: File Write Node
- FileCopyActivity: File Copy Node
- CsvReadActivity: CSV Read Node
Update History
| Date | Version | Description |
|---|---|---|
| 2025-11-28 | 1.0 | Initial version |
Last updated: 2025-11-28