get size
File size in bytes, so your workflow can make decisions
- size (bytes)
Basic data handling: PathGetSize ("get size") returns the size of a file in bytes - a plain integer out of a plain path in. It's one of those nodes you don't think you need until you're building an automation workflow and realize you've been eyeballing file sizes by hand.
Where it earns its keep: you're batch-generating or batch-processing hundreds of images and you want the graph itself to notice a problem. A generated file that came out 2 KB instead of 2 MB is almost certainly a black or broken image. Feed the byte count into a comparison node (this pack has plenty) and you can branch on it - flag undersized files, skip re-saving already-written ones, or log sizes into a text file for later inspection. It's the kind of sanity check that normally requires a shell script, and here it's just a node.
How it works
The node calls os.path.getsize(path) and returns the integer. Two things matter about the implementation:
- It raises if the path doesn't exist. The source explicitly throws
FileNotFoundErrorfor a missing path andValueErrorif the path is a directory rather than a regular file. So unlike the lazier loaders in this pack,get sizedoes not quietly hand you a zero - it fails loudly. If you want graceful behavior, gate it behindPathExists/PathIsFilefirst. - The output is bytes, not KB or MB. 5,242,880 bytes is 5 MB; the node gives you the raw number and lets your workflow do the math. Converting to MB is an arithmetic node away if you want it.
Inputs and outputs
- path (STRING, default
"") - must point at an existing regular file. - size (bytes) (INT) - the size, as an integer. Wire it into comparisons, arithmetic, or string formatting.
Installing it
Part of the Basic data handling pack, no dependencies beyond what ComfyUI ships. ComfyUI Manager → search "Basic data handling" → install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/StableLlama/ComfyUI-basic_data_handling
Restart after. Nothing else to set up - no models, no requirements.txt to fight.
Gotchas
The error-on-missing-path behavior is the thing that'll surprise you if you feed it from a glob or directory listing that goes stale. If you're looping over a folder and a file gets deleted between listing and sizing, the node throws and the run stops. Wrap it with PathExists and you're safe. Also remember it's a snapshot at execution time - sizes don't update unless the node re-runs, so don't rely on it for live monitoring of a file that's still being written. Small node, predictable behavior, and genuinely useful once you start treating your workflow as a small program instead of a one-shot generator.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| path | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| size (bytes) | INT | — |