Answers for "imagemin from buffer"

0

imagemin from buffer

const imagemin = require('imagemin');
const Promise = require('bluebird');

Promise.promisify(fs.readFile)('./screenshot.png')
  .then(buffer => {
    return imagemin.buffer(buffer, {
      plugins: [
          imageminMozjpeg(),
          imageminPngquant({quality: '80'})
      ]
    })
  })
  .then(outBuffer => {
    console.log(outBuffer.length);
  }).catch(err => {
    console.log(err)
  })
Posted by: Guest on September-06-2021

Browse Popular Code Answers by Language