i am using next js and try to compress image at api route( backend) and i am getting this error. error Error [TypeError]: Cannot read properties of undefined (reading 'engine')
my code :
let output_path=path.join(process.cwd(),"public","media","country","less","10mb.jpg")
let input_path=path.join(process.cwd(),"public","media","country","10mb.jpg")
compress_images(input_path, output_path, { compress_force: false, statistic: true, autoupdate: true }, false,
{ jpg: { engine: "mozjpeg", command: ["-quality", "60"] } },
function (error, completed, statistic) {
console.log("-------------");
console.log(error);
console.log(completed);
console.log(statistic);
console.log("-------------");
}
);