title: How to upload image from jimp with multer in nodejs
body: <p>I sent a request from the client with an image link in the body, in the node server I use jimp (<a href="https://www.npmjs.com/package/jimp" rel="nofollow noreferrer">Jimp NPM</a>) to resize the image which I was sent, then I need to save the image to mongodb with multer but I have some confuse with this step, does anyone have any idea ? thanks ! 
  here is my code so far : </p>
  
  <pre><code>const multer = require('multer');
  const GridFsStorage = require('multer-gridfs-storage');
  const mongoose = require('mongoose');
  
      exports.resizeImage = async function (req, res) {
          let storageFS = new GridFsStorage({
              db: app.get("mongodb"),
              file: (req, file) =&gt; {
                  return new Promise((resolve, reject) =&gt; {
                      crypto.randomBytes(16, (err, buf) =&gt; {
                          if (err) {
                              return reject(err);
                          }
                          const filename =  file.originalname;
                          const fileInfo = {
                              filename: filename,
                              bucketName: 'images'
                          };
                          resolve(fileInfo);
                      });
                  });
              }
          });
          var upload = multer({ storage: storageFS }).single('image');
          try {
              Jimp.read(req.body.imagePath)        
              .then(image =&gt; {
                  image.resize(150, 150, function (err, img) {
                      // How to store img to mongodb with multer here ? 
                  });
              })
              .catch(err =&gt; {
                  throw err
              });
  
  
          } catch (error) {
              res.send(error);
          }
      }
  </code></pre>