@cf-wasm/og
Version:
Generate Open Graph Images dynamically from HTML/CSS without a browser.
26 lines (25 loc) • 1.09 kB
TypeScript
import type { ReactNode } from 'react';
import { type RenderOptions } from './render';
import type { VNode } from './satori';
import type { MayBePromise, OnlyProps } from './types';
/** Base response options */
export interface BaseResponseOptions extends OnlyProps<ResponseInit, 'headers' | 'status' | 'statusText' | 'cf'> {
format?: 'svg' | 'png';
}
/** An interface representing options for BaseResponse */
export interface ImageResponseOptions extends RenderOptions, BaseResponseOptions {
}
/** Base response class */
export declare class BaseResponse extends Response {
constructor(input: () => MayBePromise<[ReactNode | VNode, RenderOptions | undefined]>, options?: BaseResponseOptions);
}
/** A class for rendering {@link ReactNode} to image as {@link Response} */
export declare class ImageResponse extends BaseResponse {
/**
* Creates an instance of {@link ImageResponse}
*
* @param element The {@link ReactNode}
* @param options The {@link ImageResponseOptions}
*/
constructor(element: ReactNode | VNode, options?: ImageResponseOptions);
}