Nodes/ComfyUI-Buff-Nodes/Load Text Line From File (Buff)
ComfyUI Node

Load Text Line From File (Buff)

A ComfyUI node in utils with 16 inputs and 3 outputs.

By BuffMcBigHuge·Created about a year ago·Updated 2 months ago· 2
Load Text Line From File (Buff)
    • text
    • source_file
    • line_count
    file_path
    selection_moderandom
    seed0
    index0
    text_override
    encodingutf-8
    ban_tags
    prefix
    suffix
    join_delimiter,
    weight0.00
    skip_commentstrue
    skip_blank_linestrue
    strip_whitespacetrue
    replace_underscoresfalse
    pick_random_file_from_dirfalse
    Categoryutils

    Inputs (16)

    NameTypeDefaultDescription
    file_pathSTRINGPath to a text file (.txt, .csv, etc.) or a directory. When a directory is given, a random .txt file is selected from it. Surrounding quotes are stripped automatically.
    selection_modeCOMBOrandomrandom: Pick a random line (seeded). index: Pick a specific line by index number. all: Return every line joined by the join_delimiter. sequential: Cycle through lines in order across executions.
    seedINT00–18446744073709550000Seed for random selection. Same seed + same file = same line.
    indexINT00–18446744073709550000Line index to retrieve when selection_mode is 'index'. Wraps around if out of range.
    text_overrideoptSTRINGWhen provided, this text is used instead of reading from file_path. All line selection and filtering still applies. Right-click and Convert to Input to connect a wire instead.
    encodingoptCOMBOutf-8File encoding to use when reading the text file.
    ban_tagsoptSTRINGComma-separated list of tags/words to remove from the output. Surrounding commas and extra spaces are cleaned up.
    prefixoptSTRINGText to prepend to the output.
    suffixoptSTRINGText to append to the output.
    join_delimiteroptSTRING, Delimiter used to join lines when selection_mode is 'all'.
    weightoptFLOAT0.00-10–10When non-zero, wraps output as (text:weight) for prompt weighting.
    skip_commentsoptBOOLEANtrueSkip lines starting with '#' (after stripping whitespace).
    skip_blank_linesoptBOOLEANtrueSkip empty or whitespace-only lines.
    strip_whitespaceoptBOOLEANtrueStrip leading/trailing whitespace from each line.
    replace_underscoresoptBOOLEANfalseReplace underscores with spaces in the output text.
    pick_random_file_from_diroptBOOLEANfalseWhen True and file_path is a directory, pick a random .txt file from it.

    Outputs (3)

    NameTypeDescription
    textSTRING
    source_fileSTRING
    line_countINT