Skip to content

Parser for express that allows file upload with multipart/form-data, compatible with google cloud functions

License

Notifications You must be signed in to change notification settings

cristovao-trevisan/express-multipart-file-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Parser for express that allows file upload with multipart/form-data, compatible with google cloud functions

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published