UNPKG

svg2png-wasm

Version:

A svg to png converter made with wasm.

36 lines (34 loc) 1.08 kB
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; export type DefaultFontFamily = { serifFamily?: string; sansSerifFamily?: string; cursiveFamily?: string; fantasyFamily?: string; monospaceFamily?: string; }; export type ConverterOptions = { fonts?: Uint8Array[]; defaultFontFamily?: DefaultFontFamily; }; export type ConvertOptions = { scale?: number; width?: number; height?: number; backgroundColor?: string; }; export type Svg2png = ((svg: string, options?: ConvertOptions) => Promise<Uint8Array>) & { getLoadedFontFamilies: () => string[]; dispose: () => void; }; /** * Initialize WASM module * @param mod WebAssembly Module or WASM url */ export declare const initialize: (mod: Promise<InitInput> | InitInput) => Promise<void>; /** * @param opts Converter options (e.g. font settings) * @returns svg2png converter */ export declare const createSvg2png: (opts?: ConverterOptions) => Svg2png; export declare const svg2png: (svg: string, opts?: ConverterOptions & ConvertOptions) => Promise<Uint8Array>; export {};