This module also does threadpooling internally, so we don't need Piscina anymore (which I'm pretty sure was actually bottlenecking.)
16 lines
446 B
TypeScript
16 lines
446 B
TypeScript
|
|
interface JpegInputArgs {
|
|
width: number,
|
|
height: number,
|
|
stride: number, // The width of your input framebuffer OR your image width (if encoding a full image)
|
|
buffer: Buffer
|
|
|
|
// TODO: Allow different formats, or export a boxed ffi object which can store a format
|
|
// (i.e: new JpegEncoder(FORMAT_xxx)).
|
|
}
|
|
|
|
/// Performs JPEG encoding.
|
|
export function jpegEncode(input: JpegInputArgs) : Promise<Buffer>;
|
|
|
|
// TODO: Version that can downscale?
|