Registry / serialization / body-parser-with-msgpack

body-parser-with-msgpack

JSON →
library1.17.0jsnpmunverified

Express-compatible body parsing middleware for Node.js (v1.17.0) that extends the popular body-parser module with MessagePack (msgpack) support. In addition to JSON, URL-encoded, raw, and text parsers, it provides a dedicated msgpack parser for binary MessagePack requests. Maintained as a fork, it includes automatic gzip/deflate inflation, configurable limits, and strict mode. Compatible with Node >= 0.8, intended for use with Express or Connect.

npm install body-parser-with-msgpack
INSTALL
IMPORT
SIG · BODY-PARSER-WITH-M
B
body-parser-with-msgpack
serializationjavascriptv1.17.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

bodyParser
✓ const bodyParser = require('body-parser-with-msgpack')
✗ import bodyParser from 'body-parser-with-msgpack'
This package does not ship ESM; use CommonJS require.
bodyParser.json
✓ bodyParser.json({ limit: '1mb' })
✗ bodyParser.JSON()
The method name is lowercase 'json', not 'JSON'.
bodyParser.msgpack
✓ bodyParser.msgpack({ limit: '2mb' })
✗ bodyParser.messagepack() or bodyParser.msgpack() from body-parser
This parser is unique to this fork. Do not confuse with the official body-parser.

Creates an Express app that parses JSON and MessagePack request bodies, echoes back the parsed body.

const express = require('express'); const bodyParser = require('body-parser-with-msgpack'); const app = express(); // Parse JSON bodies app.use(bodyParser.json()); // Parse MessagePack bodies app.use(bodyParser.msgpack({ limit: '2mb' })); app.post('/data', (req, res) => { res.json({ received: req.body, type: typeof req.body === 'object' ? 'object' : 'other' }); }); app.listen(3000, () => console.log('Server running on port 3000'));
Debug
Known issues
gotchaThe msgpack parser uses msgpack5 library internally; it does not support the full MessagePack spec extensions.
fix
If you need full MessagePack support (e.g., timestamps, custom types), consider using msgpack5 directly or another library.
affects: >=1.0.0
gotchaParsed MessagePack body may be a Buffer (for binary data) or an object/array. Ensure your handler checks the type.
fix
Use Buffer.isBuffer(req.body) to detect binary data, or rely on msgpack5 behavior.
affects: >=1.0.0
deprecatedThe 'inflation' option in earlier versions was misspelled 'infalting'.
fix
Use 'inflate' option instead of 'infalting'.
affects: <=1.16.4
gotchaThis package does not handle multipart bodies. Use busboy, formidable, or multer for multipart.
fix
Use the recommended modules for multipart parsing.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: bodyParser.json is not a function
Package not installed or required incorrectly.
fix
Run 'npm install body-parser-with-msgpack' and use 'const bodyParser = require("body-parser-with-msgpack")'.
Error: Cannot find module 'msgpack5'
Missing msgpack5 dependency (should be bundled).
fix
Install the package: 'npm install body-parser-with-msgpack' or if using npm < 3, install msgpack5 manually: 'npm install msgpack5'.
ReferenceError: bodyParser is not defined
Forgetting to import/require the module.
fix
Add 'const bodyParser = require("body-parser-with-msgpack")' at the top of your file.
Upgrade
Version history
1.17.0latest on npm
Audit
Dependencies
bytesrequiredParsing request body size limits.
content-typerequiredParsing Content-Type header.
debugrequiredLogging for debugging.
depdrequiredDeprecation warnings for deprecated argument signatures.
http-errorsrequiredCreating HTTP error objects for error responses.
iconv-literequiredCharacter encoding conversion.
on-finishedrequiredExecute a callback when the request finishes.
qsrequiredParsing URL-encoded bodies with extended query string support.
raw-bodyrequiredGetting the raw body from a readable stream.
type-isrequiredContent-Type inspection via mime type or extension.
msgpack5requiredMessagePack serialization/deserialization.
Agent activity
15 hits · last 30 days
node
14
OpenAI (training)
1
Resources
body-parser-with-msgpack — npm install body-parser-with-msgpack · libregistry