Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
@koa/multer
Advanced tools
Route middleware for Koa that handles `multipart/form-data` using multer
Route middleware for Koa that handles
multipart/form-data
using multer
This module is a fork of koa-multer, the most widely used multer middleware in the koa community. Due to lack of maintenance, it was forked to the official Koa organization and is available under @koa/multer
package name.
Note that you must install either
multer@1.x
(Buffer) ormulter@2.x
(Streams):
npm install --save @koa/multer multer
const Koa = require('koa');
const Router = require('@koa/router');
const multer = require('@koa/multer');
const app = new Koa();
const router = new Router();
const upload = multer(); // note you can pass `multer` options here
// add a route for uploading multiple files
router.post(
'/upload-multiple-files',
upload.fields([
{
name: 'avatar',
maxCount: 1
},
{
name: 'boop',
maxCount: 2
}
]),
ctx => {
console.log('ctx.request.files', ctx.request.files);
console.log('ctx.files', ctx.files);
console.log('ctx.request.body', ctx.request.body);
ctx.body = 'done';
}
);
// add a route for uploading single files
router.post(
'/upload-single-file',
upload.single('avatar'),
ctx => {
console.log('ctx.request.file', ctx.request.file);
console.log('ctx.file', ctx.file);
console.log('ctx.request.body', ctx.request.body);
ctx.body = 'done';
}
);
// add the router to our app
app.use(router.routes());
app.use(router.allowedMethods());
// start the server
app.listen(3000);
Name | Website |
---|---|
Nick Baugh | http://niftylettuce.com/ |
Imed Jaberi | https://www.3imed-jaberi.com/ |
MIT © Fangdun Cai
FAQs
Route middleware for Koa that handles `multipart/form-data` using multer
The npm package @koa/multer receives a total of 45,103 weekly downloads. As such, @koa/multer popularity was classified as popular.
We found that @koa/multer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 10 open source maintainers collaborating on the project.
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.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.