Summary
ImageSDK.generate() returns an ImageResponse with image URLs or base64 data, but provides no method to download or save those images to disk. Users must manually implement URL downloads with retries, base64 decoding, directory creation, and file-naming logic.
The CLI already does all of this via --out, --out-dir, and --out-prefix flags in mmx image generate.
Proposed solution
Add a save(response, options?) method to ImageSDK that:
- Downloads images from CDN URLs (with retry/backoff via the existing
downloadFile() utility)
- Decodes base64 images from the response
- Supports single-file exact path (
out) and multi-file directory output (outDir + prefix)
- Creates intermediate directories as needed
See linked PR.
Summary
ImageSDK.generate()returns anImageResponsewith image URLs or base64 data, but provides no method to download or save those images to disk. Users must manually implement URL downloads with retries, base64 decoding, directory creation, and file-naming logic.The CLI already does all of this via
--out,--out-dir, and--out-prefixflags inmmx image generate.Proposed solution
Add a
save(response, options?)method toImageSDKthat:downloadFile()utility)out) and multi-file directory output (outDir+prefix)See linked PR.