Express Multipart File Parser
Parser for express that allows file upload with multipart/form-dataWorks with Google Cloud Functions
Usage
// default parser without destructuring
const fileParser = require('express-multipart-file-parser')
...
app.use(fileParser)
...
app.post('/file', (req, res) => {
const {
fieldname,
originalname,
encoding,
mimetype,
buffer,
} = req.files[0]
...
})
Usage with Options
// must use destructuring for options
const { fileParser } = require('express-multipart-file-parser')
...
app.use(fileParser({
rawBodyOptions: {
limit: '15mb',
},
busboyOptions: {
limits: {
fields: 2
}
},
}))