How to read and write files inside a folder
Learn the supported usage scenarios when using File Reader and File Writer in the Digibee Integration Platform.
Last updated
Learn the supported usage scenarios when using File Reader and File Writer in the Digibee Integration Platform.
Last updated
Take a look at the supported usage scenarios below. For more information about each component, its parameters and operations, see the File Reader and File Writer documentation.
Let's say you have a file named "file.txt" inside "folder", available in your pipeline. To read this file inside a folder, you may use a File Reader that indicates the path "folder/file.txt". That way, you can access the file 'file.txt'.
Follow the steps below to learn how to do it:
Create a pipeline and add a File Reader.
Open the configuration form of the component.
Define the File Name parameter as "folder/file.txt".
Click on Confirm to save the component settings.
Connect the trigger with File Reader.
Run a test in the pipeline (CTRL + ENTER).
The result will be shown:
data: array with the content of the file read by File Reader.
fileName: shows the complete path of the read file.
lineCount: identifies the amount of lines within the file read by File Reader.
Let's say you have a file named "file.txt" inside "folder", available in your pipeline. To write this file inside a folder, you may use a File Writer that indicates the path "folder/file.txt". That way, you can access the file "file.txt".
Check how to do that:
Create a pipeline and add a File Writer.
Open the configuration form of the component.
Define the File Name parameter as "folder/file.txt".
Define the Data parameter as {{ message.data }}
.
Mind we're using the Double Braces expression: {{ message.data }}
to access the result of the last component. In this case, we access data
with the content of the file to be written.
Click on Confirm to save the component settings.
Connect the trigger with the File Writer.
Run a test in the pipeline (CTRL + ENTER).
The result will be shown:
fileName: shows the complete path of the written file.
success: when the result is "true", it indicates that the execution was successful.