i am using sharp.js for image manipulation in node.js
my code
sharp(path)
.toFormat('jpeg')
.toBuffer((err, data, info) => {
fs.writeFile(temp, buffer, { flag: 'w' }, function() {
response.sendFile(temp);
});
});
here temp in fs means "the path" var temp= imageDir + request.params.id;
( http://localhost:2000/images/we.png )
upload image as png format or any other format
convert that image to
JPEG
using.toFormat('jpeg')
and send to buffer- want to save that image from buffer to