Sharp.js returns incorrect dimensions (low resolution) for some images when processing multiple images simultaneously. All images are having high resolution. Here is the code. Can somebody help what am I missing?
let data = await sharp(file).metadata();
if(data && data.orientation) {
let buffer = await sharp(file).rotate().withMetadata().toBuffer();
fs.writeFileSync(file, buffer);
}