felid-multiparty

1.0.1 • Public • Published

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

Package Sidebar

Install

npm i felid-multiparty

Weekly Downloads

3

Version

1.0.1

License

MIT

Unpacked Size

4.48 kB

Total Files

4

Last publish

Collaborators

  • zoron