ComfyUI Node: Load Txt

Class Name

1hew_LoadTxt

Category
1hewNodes/io
Author
1hew (Account age: 1113days)
Extension
ComfyUI 1hewNodes
Latest Updated
2026-04-17
Github Stars
0.03K

How to Install ComfyUI 1hewNodes

Install this extension via the ComfyUI Manager by searching for ComfyUI 1hewNodes
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI 1hewNodes in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

Load Txt Description

Facilitates loading and managing text files with encoding options for AI art projects.

Load Txt:

The 1hew_LoadTxt node is designed to facilitate the loading of text files within a specified directory, offering a streamlined way to access and utilize text data in your projects. This node is particularly beneficial for AI artists who need to incorporate textual data into their workflows, as it simplifies the process of reading and managing text files. By allowing you to specify encoding options and navigate through directories, including subdirectories, this node ensures that you can efficiently handle text files regardless of their location or encoding format. Its primary goal is to provide a user-friendly interface for accessing text content, making it an essential tool for projects that require text manipulation or analysis.

Load Txt Input Parameters:

file

This parameter specifies the path to the directory or text file you wish to load. It is crucial for determining the source of the text data. If a directory is provided, the node will search for text files within it. The default value is an empty string, indicating no specific path is set initially.

encode

The encode parameter determines the character encoding used to read the text files. It supports options such as "auto", "utf-8", "utf-8-sig", "gbk", and "utf-16". The default setting is "auto", which attempts to automatically detect the correct encoding. This parameter is vital for ensuring that text is read correctly, especially when dealing with files in different languages or formats.

index

This integer parameter specifies which text file to load from the list of available files. It allows you to cycle through files by providing an index value. The index is zero-based, with a default value of 0, and it can range from -8192 to 8192. This parameter is useful for selecting specific files when multiple text files are present in the directory.

include_subdir

A boolean parameter that indicates whether to include subdirectories in the search for text files. When set to True, the node will recursively search through all subdirectories for text files. The default value is False, meaning only the specified directory is searched. This parameter is helpful for accessing text files stored in nested folder structures.

Load Txt Output Parameters:

text

This output provides the content of the loaded text file as a string. It is the primary output of the node, delivering the actual text data that can be used in subsequent processes or analyses. The text output is essential for any task that requires reading and manipulating text content.

filename

The filename output returns the name of the text file without its extension. This output is useful for identifying the source file of the text content, especially when working with multiple files. It helps in organizing and referencing text data within your project.

Load Txt Usage Tips:

  • To ensure compatibility with various text file encodings, use the "auto" option for the encode parameter, which will attempt to detect the correct encoding automatically.
  • When working with large directories containing numerous text files, use the index parameter to efficiently select and load specific files without manually searching through the directory.

Load Txt Common Errors and Solutions:

Txt file not found: <file>

  • Explanation: This error occurs when the specified file or directory does not contain any text files, or the path is incorrect.
  • Solution: Verify that the file parameter is set to the correct path and that the directory contains text files with valid extensions.

UnicodeDecodeError

  • Explanation: This error arises when the node fails to decode the text file using the specified encoding.
  • Solution: Try using the "auto" option for the encode parameter to allow the node to automatically detect the correct encoding. If the issue persists, manually specify a different encoding that matches the file's format.

Load Txt Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI 1hewNodes
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Models, enabling artists to harness the latest AI tools to create incredible art.

Load Txt