mozjpeg-js
Implementation of MozJPEG in pure JavaScript, using Emscripten
Usage
$ npm i -S mozjpeg-js
Call mozjpeg.encode
with a typed array or buffer of data and an arguments object:
const mozjpeg = ;const fs = ; const input = fs;const out = mozjpeg;// out = { data: <mozjpeg output>, stderr: <cjpeg stderr> } console;fs;
Alternatively, you may specify arguments as an array:
const input = fs;const out = mozjpeg;...
You may use any options available in mozjpeg's cjpeg command line utility.