File
⚠️ DEPRECATION WARNING
This component is deprecated and will be removed in a future version of Nappai. Please migrate to the recommended alternative components.
The File component lets you bring a text file into your Nappai workflow.
Simply upload a file or pick one from your existing files, and the component will read its contents and make them available for the next steps in your automation.
How it Works
When you provide a file, the component checks the file’s extension to make sure it’s one of the supported text types (.txt
, .csv
, .json
, .md
, etc.).
If the file is valid, it reads the file locally and converts the text into a Data object that can be used by other components.
If you also want to keep a copy of the file itself, the component can return a Message that contains the file so you can download it later.
The component does not call any external services; everything happens on your machine or within the Nappai environment.
Inputs
- Upload file or select file:
Choose a file from your computer or from the list of files already stored in the workflow. Supported file types are:txt, csv, json, md, yaml, yml, xml, html, txt, txt
. - Silent Errors:
If set to true, the component will not raise an exception when it encounters a problem (e.g., unsupported format). Instead, it will simply report the issue in its status.
Outputs
-
Data – Data (method:
load_file
)
The parsed contents of the file as a Data object. If the file is empty or cannot be parsed, the output will be an empty Data object. -
Files – Message (method:
result_file
)
A message that contains the file itself, allowing you to download or pass the file to other components that expect a file input.
Usage Example
- Drag the File component onto the canvas.
- Click the Upload file or select file field and choose a
txt
orcsv
file. - Connect the Data output to a Text Splitter component to break the text into sentences.
- Optionally, connect the Files output to a Download component so users can retrieve the original file.
Related Components
- Text Splitter – Breaks text into smaller chunks (sentences, paragraphs, etc.).
- Data Processor – Performs transformations or calculations on Data objects.
- Download – Lets users download files produced by the workflow.
Tips and Best Practices
- Keep file sizes small (under a few megabytes) to avoid long load times.
- Use only supported file extensions;
.doc
files are not supported—save them as.docx
instead. - If you need to handle errors gracefully, enable Silent Errors so the workflow can continue even if a file is missing or corrupted.
- When sharing workflows, double‑check that the file paths are relative or that the files are uploaded, so the component can find them.
Security Considerations
- The component reads files from the local environment or from files already uploaded to Nappai.
- It does not expose file paths or contents to external services, so there is no risk of leaking sensitive data over the network.
- Always verify that the files you upload do not contain malicious code or large binary data that could consume resources.