Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@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 62,378 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.