ComfyUI Node

Bundle To String

Give your grid outputs a name you can actually read

By Stibo·Created 7 months ago·Updated 7 days ago· 11
Bundle To String
  • bundle
  • string
◄mode▾►

Bundles are great at carrying values and terrible at telling you what's in them. That's the gap this node fills, and it's a one-job node: take a bundle, hand back a string.

It matters more than it sounds, because in this pack a bundle is usually a grid cell. Twelve combinations of CFG, steps and sampler produce twelve bundles; without a way to turn those into text, you get twelve identically-named PNGs and forty minutes of comparing them by eye.

What it's for

  • Filenames that explain themselves. %date:yyyy-MM-dd%_cfg4.5_st20_euler.png is a file you can sort, filter and delete in a folder view.
  • Prompt assembly. Bake swept values into the prompt itself, or into a note/print node, so a run is auditable after the fact.
  • Debugging. Bundle Get returns nothing for a key that isn't there, silently. Printing the whole bundle as a string is the fastest way to find out your key is actually settings.width and not width.

The two modes

mode is a dynamic dropdown, meaning a second widget appears underneath depending on what you pick.

delimiter joins the scalar values of the bundle's top level with a separator string (default -). You get 4.5-20-euler - values only, no keys. It skips anything that isn't a string, int, float or bool, so a nested dict or an image tensor in the bundle is simply left out. Order is the bundle's insertion order, i.e. whichever order the pack/set nodes wrote them in, which is a thing to check rather than assume.

pattern is the one you'll end up using. You write a template with {key} placeholders, and nested keys work via dot notation:

{cfg}-{steps}-{sampler}
{settings.width}x{settings.height}

Two behaviors worth internalizing: missing keys produce an empty string rather than an error, and non-scalar values do too. So a typo'd placeholder doesn't fail, it just leaves a hole in your filename - _8x_ looks nearly like a working naming scheme until you notice every file says the same thing.

Booleans become true / false, since Python's True would look like a typo in a filename.

Inputs and outputs

  • bundle - required. The bundle to stringify.
  • mode - delimiter (with delimiter, default -) or pattern (with pattern, default {name}).

One output: string. It goes into a Save Image filename prefix, a note/preview node, or anything else that consumes text.

Installing it

ComfyUI Manager → search Nifty Nodes, or:

cd ComfyUI/custom_nodes
git clone https://github.com/Stibo/comfyui-nifty-nodes

Restart ComfyUI. The pack's declared dependencies (color-matcher, imageio-ffmpeg) aren't needed by this node and are installed for you by Manager anyway.

One structural note that applies to the whole pack: it's built on ComfyUI's newer V3 node API (comfy_api.latest, define_schema, no NODE_CLASS_MAPPINGS), which is why the source looks unfamiliar. It's a small, single-author pack - there's essentially no community lore to fall back on, so read the tooltips, which are unusually good here.

Where people get burned

  • delimiter mode is order-dependent and unlabeled. 4.5-20-euler is only useful if you remember which is which. For anything you'll look at again in a week, use pattern.
  • Nested values need the full path. {width} finds nothing if the key is settings.width. Empty string, no warning.
  • Floats carry Python's formatting. 3.5 prints as 3.5, but some computed values print long tails. Round them where they're created rather than in the filename - or you get files named _3.5000001_.
  • Illegal filename characters. Some samplers and model names contain characters that a filesystem will reject (looking at you, :). Sanitize upstream, or keep the pattern to numbers you swept yourself.
Categorynifty/string

Inputs (2)

NameTypeDefaultDescription
bundleBUNDLEBundle whose scalar values are converted to a string.
modeCOMBO'delimiter' joins all scalar values of the first level with a separator. 'pattern' places bundle values into a template string using {key} placeholders.

Outputs (1)

NameTypeDescription
stringSTRING—