ComfyUI > Nodes > DJZ-Nodes > Save Text

ComfyUI Node: Save Text

Class Name

SaveText

Category
file
Author
DriftJohnson (Account age: 4052days)
Extension
DJZ-Nodes
Latest Updated
2025-04-25
Github Stars
0.04K

How to Install DJZ-Nodes

Install this extension via the ComfyUI Manager by searching for DJZ-Nodes
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter DJZ-Nodes 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 Text Description

Facilitates saving text data to file with options for append, overwrite, or create new files, ensuring efficient data writing and organization.

Save Text:

The SaveText node is designed to facilitate the process of saving text data to a file within a specified directory. This node is particularly useful for AI artists and developers who need to store generated text outputs or logs in a structured manner. By providing options to append, overwrite, or create new files only if they do not exist, the SaveText node offers flexibility in managing file operations. Its primary function is to ensure that text data is efficiently written to a file, with the ability to insert new lines if desired. This node is an essential tool for organizing and preserving text data generated during creative processes, making it easier to manage and retrieve information when needed.

Save Text Input Parameters:

root_dir

The root_dir parameter specifies the directory where the text file will be saved. It accepts valid paths from ComfyUI's folder paths, such as output, input, or temporary directories. This parameter is crucial as it determines the location of the saved file, ensuring that the text data is stored in an organized manner. There are no specific minimum or maximum values, but it must be a valid directory path.

file

The file parameter defines the name of the text file to be created or modified. It is a string value with a default of "file.txt". This parameter is important because it specifies the exact file where the text will be saved, allowing for easy identification and retrieval of the stored data.

append

The append parameter controls how the text is written to the file. It offers three options: "append", "overwrite", and "new only". "Append" adds the text to the end of the file, "overwrite" replaces the existing content, and "new only" creates a new file if it does not already exist. This parameter is essential for managing file content and ensuring that text is saved according to the desired operation.

insert

The insert parameter is a boolean that determines whether a new line should be inserted before the text when appending. It defaults to True, meaning a new line will be added. This parameter is useful for formatting the text within the file, ensuring that new entries are clearly separated from existing content.

text

The text parameter is the actual content to be saved in the file. It is a string that supports multiline input, allowing for comprehensive text data to be stored. This parameter is the core of the node's functionality, as it represents the information that the user wishes to preserve.

Save Text Output Parameters:

text

The text output parameter returns the text that was written to the file. This output is important as it confirms the content that has been saved, allowing users to verify that the correct data has been stored.

file_path

The file_path output parameter provides the full path to the file where the text was saved. This output is crucial for locating the file within the directory structure, ensuring that users can easily access and manage their saved text data.

Save Text Usage Tips:

  • To ensure that your text data is not accidentally overwritten, use the "new only" option in the append parameter. This will prevent the node from writing to a file that already exists, safeguarding your existing data.
  • When appending text to a file, consider setting the insert parameter to True to maintain clear separation between entries. This will help keep your file organized and easy to read.

Save Text Common Errors and Solutions:

FileExistsError: File <file_path> already exists and 'new only' mode was selected

  • Explanation: This error occurs when the "new only" mode is selected, but a file with the specified name already exists in the directory.
  • Solution: Change the file parameter to a different name or switch the append parameter to "append" or "overwrite" to modify the existing file.

PermissionError: [Errno 13] Permission denied: <file_path>

  • Explanation: This error indicates that the node does not have the necessary permissions to write to the specified directory or file.
  • Solution: Ensure that the directory and file permissions allow writing. You may need to adjust the permissions or choose a different directory where you have write access.

Save Text Related Nodes

Go back to the extension to check out more related nodes.
DJZ-Nodes
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 Playground, enabling artists to harness the latest AI tools to create incredible art.