Friday, 20 September 2019

can i acess res object in multer custom storage engine _handleFile function

i need to acess the res object in multer custom storage engine _handleFile function is there any way? currently there is only req, file, cb

MyCustomStorage.prototype._handleFile = function _handleFile (req, file, cb) {
this.getDestination(req, file, function (err, path) {
if (err) return cb(err)

var outStream = fs.createWriteStream(path)

file.stream.pipe(outStream)
outStream.on('error', cb)
outStream.on('finish', function () {
  cb(null, {
    path: path,
    size: outStream.bytesWritten
  })
})
})
}

there is no res object to acess



from can i acess res object in multer custom storage engine _handleFile function

No comments:

Post a Comment