UNPKG

lightningimg

Version:

A blazing fast, transparent, and safe image converter powered by WebAssembly. Convert PNG, JPG, TIFF, and GIF images to optimized WebP format with high performance and cross-platform compatibility.

64 lines (59 loc) 2.9 kB
/* tslint:disable */ /* eslint-disable */ export function init_panic_hook(): void; /** * Converts an image buffer to WebP format. * This is the core function that browsers and Node.js can use. */ export function convert_image_buffer(input_buffer: Uint8Array, width?: number, height?: number): Uint8Array; /** * Determines if an image format is supported based on the first few bytes. */ export function is_supported_format(buffer: Uint8Array): boolean; /** * Get image format information from buffer */ export function get_image_info(buffer: Uint8Array): any; /** * Processes all images in a directory recursively, converting them to WebP format. * This function is designed to work in Node.js environments where fs module is available. */ export function process_directory(_input_dir: string, _output_dir?: string): void; /** * Processes all images in a directory recursively, converting them to WebP format and optionally keeping original file names. */ export function process_directory_destructive(_input_dir: string, _keep_original_names?: boolean): void; export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; export interface InitOutput { readonly memory: WebAssembly.Memory; readonly init_panic_hook: () => void; readonly convert_image_buffer: (a: number, b: number, c: number, d: number, e: number) => void; readonly is_supported_format: (a: number, b: number) => number; readonly get_image_info: (a: number, b: number, c: number) => void; readonly process_directory: (a: number, b: number, c: number, d: number, e: number) => void; readonly process_directory_destructive: (a: number, b: number, c: number, d: number) => void; readonly __wbindgen_export_0: (a: number, b: number, c: number) => void; readonly __wbindgen_export_1: (a: number) => void; readonly __wbindgen_export_2: (a: number, b: number) => number; readonly __wbindgen_export_3: (a: number, b: number, c: number, d: number) => number; readonly __wbindgen_add_to_stack_pointer: (a: number) => number; } export type SyncInitInput = BufferSource | WebAssembly.Module; /** * Instantiates the given `module`, which can either be bytes or * a precompiled `WebAssembly.Module`. * * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated. * * @returns {InitOutput} */ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput; /** * If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated. * * @returns {Promise<InitOutput>} */ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;