Skip to content

felidjs/felid-multiparty

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

felid-multiparty

npm version Node.js CI JavaScript Style Guide codecov

Multiparty plugin for Felid. Upload files without caring.

Install

npm install felid-multiparty

or

yarn add felid-multiparty

Usage

const Felid = require('felid')
const multiparty = require('felid-multiparty')

const app = new Felid()
app.plugin(multiparty, options)

app.post('/upload', async (req, res) => {
  const { files } = await req.upload()
  // Supposed you uploaded the file as in a field named 'file'
  const file = files.file[0]
  res.send({
    originalFilename: file.originalFilename,
    path: file.path
  })
})

Options

  • decorator Object: Customize the decorator names. Default is:
{
  upload: 'upload'
}

API

  • request.upload(options?: Object) => Promise: Handle the multipart payload. See document of multiparty for more options.

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •