express-multipart-file-parser

[![npm version](https://badge.fury.io/js/express-multipart-file-parser.svg)](https://badge.fury.io/js/express-multipart-file-parser) [![Code style: airbnb](https://img.shields.io/badge/code%20style-airbnb-blue.svg?style=flat-square)](https://github.com/ai

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
express-multipart-file-parser
0.1.26 years ago6 years agoMinified + gzip package size for express-multipart-file-parser in KB

Readme

npm version Code style: airbnb
Express Multipart File Parser
Parser for express that allows file upload with multipart/form-data
Works 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
    }
  },
}))

Options