Socket
Socket
Sign inDemoInstall

egg-multer

Package Overview
Dependencies
85
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    egg-multer

[![NPM version][npm-image]][npm-url] [![build status][travis-image]][travis-url] [![Test coverage][codecov-image]][codecov-url] [![David deps][david-image]][david-url] [![Known Vulnerabilities][snyk-image]][snyk-url] [![npm download][download-image]][down


Version published
Weekly downloads
84
decreased by-16.83%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

egg-multer

NPM version build status Test coverage David deps Known Vulnerabilities npm download

Install

$ npm i egg-multer --save

Usage

// {app_root}/config/plugin.js
exports.multer = {
  enable: true,
  package: 'egg-multer',
}

Configuration

// {app_root}/config/config.default.js

// Accept a single file with the name `uri`
exports.multer = {
  single: 'uri', 
}

// Accept an array of files, all with the name `files`
exports.multer = {
  array: 'files', 
}

// Accept a mix of files, specified by fields
exports.multer = {
  fields: [{name: 'file', maxCount: 1}],
}

// Accept only text fields
exports.multer = {
  none: true,
}

// Accepts all files that comes over the wire
exports.multer = {
  any: true,
}

see config/config.default.js for more detail.

Example

async multer() {
  const { ctx, app } = this
  console.log('is multipart', ctx.is('multipart'))
  console.log('is json', ctx.is('json'))
  console.log('request.body', ctx.request.body)
  console.log('ctx.file', ctx.file)
  console.log('ctx.files', ctx.files)
  ctx.body = { ok: 1 }
}

Questions & Suggestions

Please open an issue here.

License

MIT

Keywords

FAQs

Last updated on 31 Mar 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc