title: multer create folder if not exist
body: <p>I saw in documentation of multer, that if folder doesn't exist, the multer will not create folder.  How can i create a folder if not exist?</p>
  
  <pre><code>import multer from 'multer'
  import crypto from 'crypto'
  import { extname, resolve } from 'path'
  import slug from 'slug'
  
  export default {
    storage: multer.diskStorage({
      destination: resolve(__dirname, '..', '..', 'uploads', 'gallery'),
      filename: (req, file, cb) =&gt; {
        const { id, description } = req.body
  
        crypto.randomBytes(8, (err, res) =&gt; {
          if (err) return cb(err)
  
          return cb(null, id + '/' + res.toString('hex') + '/' + slug(description, { lower: true }) + extname(file.originalname))
          // return cb(null, res.toString('hex') + extname(file.originalname))
        })
      }
    })
  }
  </code></pre>