ComfyUI Node: Save Txt

Class Name

1hew_SaveTxt

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

Save Txt Description

The 1hew_SaveTxt node automates saving text to .txt files, enhancing data management in ComfyUI.

Save Txt:

The 1hew_SaveTxt node is designed to facilitate the saving of text data into a .txt file format, providing a streamlined method for storing textual information generated within the ComfyUI environment. This node is particularly beneficial for AI artists and developers who need to persistently save outputs from their workflows, ensuring that important data is not lost and can be easily accessed or shared later. By automating the process of writing text to files, the node enhances productivity and reduces the manual effort involved in data management. It supports various encoding options, allowing for flexibility in handling different character sets, and offers features such as automatic file name incrementation to prevent overwriting existing files. This makes it an essential tool for managing text outputs efficiently and effectively.

Save Txt Input Parameters:

any

This parameter accepts any type of input that can be converted to a string. It represents the text content that you wish to save to a file. If this parameter is not provided, the node will not perform any file-saving operation. There are no specific minimum or maximum values for this parameter, as it is designed to handle a wide range of input types.

filename

The filename parameter specifies the desired name or path for the output text file. By default, it is set to "txt/ComfyUI". This parameter allows you to define a custom file name or directory path where the text file will be saved. If the path is not absolute, it will be considered relative to the base output directory. There are no strict constraints on the values, but it should be a valid file path.

auto_increment

This boolean parameter determines whether the node should automatically increment the file name to avoid overwriting existing files. When set to True (the default), the node will append a number to the file name if a file with the same name already exists. If set to False, the node will overwrite any existing file with the same name. This feature is useful for maintaining a history of outputs without manual intervention.

save_output

The save_output parameter is a boolean that controls whether the text content should be saved to a file. By default, it is set to True, meaning the node will write the text to a file. If set to False, the node will not perform any file-saving operation, which can be useful for previewing outputs without committing them to disk.

encode

This parameter specifies the encoding format for the text file. It offers options such as "utf-8", "utf-8-sig", and "gbk", with "utf-8" being the default. The choice of encoding affects how characters are represented in the file, which is important for ensuring compatibility with different systems and applications that may read the file.

Save Txt Output Parameters:

file_path

The file_path output parameter provides the absolute path to the saved text file. This output is crucial for verifying the location of the saved file and for subsequent operations that may require access to the file. It ensures that you have a clear reference to where the text data has been stored, facilitating easy retrieval and management.

Save Txt Usage Tips:

  • To prevent overwriting important files, enable the auto_increment option, which will automatically append a number to the file name if a file with the same name already exists.
  • Use the encode parameter to ensure that your text files are saved with the correct character encoding, especially if you are working with non-ASCII characters or need compatibility with specific software.
  • If you only need to preview the text output without saving it, set the save_output parameter to False to avoid unnecessary file creation.

Save Txt Common Errors and Solutions:

FileNotFoundError

  • Explanation: This error may occur if the specified directory in the filename parameter does not exist.
  • Solution: Ensure that the directory path specified in the filename parameter is valid and exists. You can create the directory manually or adjust the path to an existing directory.

PermissionError

  • Explanation: This error can happen if the node does not have the necessary permissions to write to the specified directory.
  • Solution: Check the permissions of the directory where you are trying to save the file. Ensure that the application has write access to the directory.

ValueError: Invalid encoding

  • Explanation: This error occurs if an unsupported encoding is specified in the encode parameter.
  • Solution: Use one of the supported encoding options: "utf-8", "utf-8-sig", or "gbk". Double-check the spelling and case of the encoding name.

Save 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.

Save Txt