ComfyUI Node: decode

Class Name

Basic data handling: StringDecode

Category
Basic/STRING
Author
StableLlama (Account age: 861days)
Extension
Basic data handling
Latest Updated
2026-05-07
Github Stars
0.04K

How to Install Basic data handling

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

decode Description

Converts byte-encoded strings to readable text, supporting various character encodings for versatile data handling.

decode:

The StringDecode node is designed to convert a bytes-like string representation back into a human-readable text string. This is particularly useful when dealing with data that has been encoded into bytes for storage or transmission, such as when receiving data from files or network sources. By decoding these byte strings, you can transform them back into their original text form, making them easier to read and process. The node supports various character encodings, allowing you to handle a wide range of encoded data formats. This flexibility ensures that you can accurately decode strings encoded in different character sets, making it a versatile tool for data handling in your projects.

decode Input Parameters:

bytes_string

The bytes_string parameter is the input string that represents bytes, typically prefixed with b' or b". This parameter is crucial as it contains the encoded data that you wish to decode back into a text string. The default value is b'', indicating an empty bytes string. It is important to ensure that the input follows the correct bytes string format to avoid errors during decoding.

encoding

The encoding parameter specifies the character encoding used to decode the bytes string. It determines how the byte sequences are interpreted as characters. Available options include utf-8, ascii, latin-1, utf-16, utf-32, and cp1252. The default encoding is utf-8, which is widely used due to its compatibility with a vast range of characters. Choosing the correct encoding is essential for accurate decoding of the input data.

errors

The errors parameter defines the error handling scheme to use during decoding. Options include strict, ignore, replace, and backslashreplace. The default is strict, which raises an error on encountering invalid byte sequences. Other options allow for more lenient handling, such as ignoring errors or replacing problematic bytes with a placeholder. This parameter is useful for managing unexpected or malformed data during the decoding process.

decode Output Parameters:

IO.STRING

The output of the StringDecode node is a decoded text string, represented as IO.STRING. This output is the human-readable version of the input bytes string, transformed according to the specified encoding and error handling parameters. It allows you to work with the original text data, facilitating further processing or display in your applications.

decode Usage Tips:

  • Ensure that the bytes_string input is correctly formatted as a bytes literal (e.g., b'text') to avoid format errors during decoding.
  • Use the encoding parameter to match the encoding used during the original encoding process to ensure accurate decoding.
  • Adjust the errors parameter to handle unexpected byte sequences gracefully, especially when dealing with data from unreliable sources.

decode Common Errors and Solutions:

Input is not a bytes string representation: <bytes_string>

  • Explanation: This error occurs when the input string does not follow the expected bytes string format, typically missing the b' or b" prefix.
  • Solution: Verify that the input string is correctly formatted as a bytes literal, ensuring it starts with b' or b" and ends with the corresponding quote.

Decoding error: <error_message>

  • Explanation: This error indicates that an issue occurred during the decoding process, possibly due to an unsupported byte sequence or incorrect encoding.
  • Solution: Check the encoding parameter to ensure it matches the encoding used during the original encoding process. Consider using a different error handling strategy, such as ignore or replace, to bypass problematic byte sequences.

decode Related Nodes

Go back to the extension to check out more related nodes.
Basic data handling
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.

decode