{"id":27619,"library":"body-parser-with-msgpack","title":"body-parser-with-msgpack","description":"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.","status":"active","version":"1.17.0","language":"javascript","source_language":"en","source_url":"https://github.com/MobiltronInc/body-parser","tags":["javascript","express","expressjs","messagepack","msgpack","body-parser"],"install":[{"cmd":"npm install body-parser-with-msgpack","lang":"bash","label":"npm"},{"cmd":"yarn add body-parser-with-msgpack","lang":"bash","label":"yarn"},{"cmd":"pnpm add body-parser-with-msgpack","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Parsing request body size limits.","package":"bytes","optional":false},{"reason":"Parsing Content-Type header.","package":"content-type","optional":false},{"reason":"Logging for debugging.","package":"debug","optional":false},{"reason":"Deprecation warnings for deprecated argument signatures.","package":"depd","optional":false},{"reason":"Creating HTTP error objects for error responses.","package":"http-errors","optional":false},{"reason":"Character encoding conversion.","package":"iconv-lite","optional":false},{"reason":"Execute a callback when the request finishes.","package":"on-finished","optional":false},{"reason":"Parsing URL-encoded bodies with extended query string support.","package":"qs","optional":false},{"reason":"Getting the raw body from a readable stream.","package":"raw-body","optional":false},{"reason":"Content-Type inspection via mime type or extension.","package":"type-is","optional":false},{"reason":"MessagePack serialization/deserialization.","package":"msgpack5","optional":false}],"imports":[{"note":"This package does not ship ESM; use CommonJS require.","wrong":"import bodyParser from 'body-parser-with-msgpack'","symbol":"bodyParser","correct":"const bodyParser = require('body-parser-with-msgpack')"},{"note":"The method name is lowercase 'json', not 'JSON'.","wrong":"bodyParser.JSON()","symbol":"bodyParser.json","correct":"bodyParser.json({ limit: '1mb' })"},{"note":"This parser is unique to this fork. Do not confuse with the official body-parser.","wrong":"bodyParser.messagepack() or bodyParser.msgpack() from body-parser","symbol":"bodyParser.msgpack","correct":"bodyParser.msgpack({ limit: '2mb' })"}],"quickstart":{"code":"const express = require('express');\nconst bodyParser = require('body-parser-with-msgpack');\n\nconst app = express();\n\n// Parse JSON bodies\napp.use(bodyParser.json());\n\n// Parse MessagePack bodies\napp.use(bodyParser.msgpack({ limit: '2mb' }));\n\napp.post('/data', (req, res) => {\n  res.json({\n    received: req.body,\n    type: typeof req.body === 'object' ? 'object' : 'other'\n  });\n});\n\napp.listen(3000, () => console.log('Server running on port 3000'));","lang":"javascript","description":"Creates an Express app that parses JSON and MessagePack request bodies, echoes back the parsed body."},"warnings":[{"fix":"If you need full MessagePack support (e.g., timestamps, custom types), consider using msgpack5 directly or another library.","message":"The msgpack parser uses msgpack5 library internally; it does not support the full MessagePack spec extensions.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use Buffer.isBuffer(req.body) to detect binary data, or rely on msgpack5 behavior.","message":"Parsed MessagePack body may be a Buffer (for binary data) or an object/array. Ensure your handler checks the type.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use 'inflate' option instead of 'infalting'.","message":"The 'inflation' option in earlier versions was misspelled 'infalting'.","severity":"deprecated","affected_versions":"<=1.16.4"},{"fix":"Use the recommended modules for multipart parsing.","message":"This package does not handle multipart bodies. Use busboy, formidable, or multer for multipart.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Run 'npm install body-parser-with-msgpack' and use 'const bodyParser = require(\"body-parser-with-msgpack\")'.","cause":"Package not installed or required incorrectly.","error":"TypeError: bodyParser.json is not a function"},{"fix":"Install the package: 'npm install body-parser-with-msgpack' or if using npm < 3, install msgpack5 manually: 'npm install msgpack5'.","cause":"Missing msgpack5 dependency (should be bundled).","error":"Error: Cannot find module 'msgpack5'"},{"fix":"Add 'const bodyParser = require(\"body-parser-with-msgpack\")' at the top of your file.","cause":"Forgetting to import/require the module.","error":"ReferenceError: bodyParser is not defined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}