express-multipart-file-parser
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/express-multipart-file-parser package

0.1.2 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i express-multipart-file-parser

Weekly Downloads

3,754

Version

0.1.2

License

MIT

Unpacked Size

4.87 kB

Total Files

5

Last publish

Collaborators

  • cristovao-trevisan