1

I'm running a node application. For Image processing I was using multer and sharp packages. Everything seems to be working fine. I get whatever result I want like saving the image in a file or just only getting the buffer including features like resize, crop etc. But I'm facing a warning message like this in the console.

** (sharp:8480): WARNING **: 19:23:34.177: jpegsave_buffer: no property named 'subsample_mode'

My code goes as follows:

const storage = multer.memoryStorage();
const upload = multer({ storage: storage });

const sharpResize = async function (req, res, next) {
  req.file = await sharp(req.file.buffer)
    .resize(400, 400)
    .toFormat("jpeg")
    .jpeg({ quality: 80 })
    .toBuffer();
  next();
};

app.post("/upload-final", upload.single("image"), sharpResize, (req, res) => {
  console.log(req.file);
  res.json({ msg: "success" });
});

What am I missing or how can I suppress this warning message?

Edit

In case needed I'm using sharp version 0.27.0 and libvips version 8.10.5

Sagor Mahtab
  • 147
  • 3
  • 11
  • I'm seeing this error as well - let me know if you have any luck! – Logan Shire Sep 04 '21 at 08:09
  • In another project, I used that piece of code into a regular function and returned the buffer from the function. Didn't use a middleware function or directly modifying req.file like here. Idk why but that warning message didn't appear there. @LoganShire – Sagor Mahtab Sep 05 '21 at 12:10

0 Answers0