Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
http-body-parser
Advanced tools
#### 🎨 A body parser for node, koa, koa2, express. support json, form, text, multipart and stream type body.
🔥 A body parser for koa, express. support json
, form
, text
, multipart
and stream
type body.
const Koa = require('koa');
const bodyParser = require('http-body-parser').koa;
const app = new Koa();
app.use(bodyParser({}));
app.use(async ctx => {
// the parsed body will store in ctx.request.body
// if nothing was parsed, body will be an empty object {}
ctx.body = ctx.request.body;
});
const express = require('express');
const bodyParser = require('http-body-parser').express;
const app = express();
app.use(bodyParser({}));
server.use('/', function(req, res) {
res.send(req.body)
})
{
enableTypes: ['json', 'form', 'text', 'multipart', 'stream'],
json: {
limit: 1024*1024,
strict: true,
extendsTypes: []
},
text: {
limit: 1024*1024,
extendsTypes: []
},
form: {
limit: 56*1024,
extendsTypes: []
},
stream: {
limit: 1024*1024,
path: `the operating system's default directory`
},
multipart: {
limit: 1024*1024,
path: `the operating system's default directory`
}
}
['json', 'form', 'text', 'multipart', 'stream']
.utf-8
.true
.application/x-javascript
multipart, stream
You can access raw request body by ctx.request.rawBody
FAQs
🎨 A body parser for node, koa, koa2, express. support json, form, text, multipart and stream type body.
The npm package http-body-parser receives a total of 73 weekly downloads. As such, http-body-parser popularity was classified as not popular.
We found that http-body-parser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.