Function: toBytes()
ts
function toBytes(input: GenerationImageInput): Promise<{
bytes: Uint8Array;
mimeType?: string;
}>;Defined in: src/batteries/generation/_shared/index.ts:69
Normalizes any GenerationImageInput form to plain bytes plus an optional MIME type.
Parameters
| Parameter | Type | Description |
|---|---|---|
input | GenerationImageInput | The image input in any accepted form. |
Returns
Promise<{ bytes: Uint8Array; mimeType?: string; }>
The normalized bytes and MIME type (MIME undefined only for the bare-Uint8Array form).
Remarks
A bare Uint8Array passes through with mimeType: undefined (the caller declared no MIME). A GenerationBytesInput passes its bytes/mimeType through unchanged. A GenerationMediaLike is resolved by awaiting asBytes() and reading mimeType off it.