{
  "name": "Batch Base64 Encode Files",
  "version": "1.0",
  "description": "Encode all files in a directory to Base64 format. Supports images, configs, and binary files.",
  "author": "ToolPilot.dev",
  "url": "https://toolpilot.dev/guides/batch-processing/batch-base64-encode/",
  "steps": [
    {
      "id": "find_files",
      "tool": "find",
      "description": "Locate files to encode",
      "command": "find {input_dir} -type f -name '{pattern}'",
      "defaults": {
        "input_dir": ".",
        "pattern": "*.png"
      }
    },
    {
      "id": "encode",
      "tool": "base64",
      "description": "Base64 encode each file",
      "command": "base64 -w0 {file} > {file}.b64",
      "loop": true,
      "input_from": "find_files"
    },
    {
      "id": "verify",
      "tool": "wc",
      "description": "Count encoded files",
      "command": "find {input_dir} -name '*.b64' | wc -l"
    }
  ],
  "bash_oneliner": "find . -type f -name '*.png' -exec sh -c 'base64 \"$1\" > \"$1.b64\"' _ {} \\;",
  "python_command": "python3 -c \"import base64; from pathlib import Path; [Path(f'{p}.b64').write_text(base64.b64encode(p.read_bytes()).decode()) for p in Path('.').glob('*.png')]\"",
  "environment": {
    "requires": ["base64 (coreutils)"],
    "optional": ["python3", "node"]
  }
}
