5.0.2 • Published 4 months ago
milliparsec v5.0.2
Tiniest body parser in the universe. Built for modern Node.js.
Check out deno-libs/parsec for Deno port.
Features
- 🛠 JSON / raw / urlencoded / multipart support
- 📦 tiny package size (8KB dist size)
- 🔥 no dependencies
- ✨ tinyhttp and Express support
- ⚡ 40% faster than body-parser and 20x faster than formidable
Install
# pnpm
pnpm i milliparsec
# bun
bun i milliparsec
Usage
Basic example
Use a middleware inside a server:
import { createServer } from 'node:http'
import { json } from 'milliparsec'
const server = createServer(async (req: ReqWithBody, res) => {
await json()(req, res, (err) => void err && res.end(err))
res.setHeader('Content-Type', 'application/json')
res.end(JSON.stringify(req.body))
})
What is "parsec"?
The parsec is a unit of length used to measure large distances to astronomical objects outside the Solar System.
5.0.2
4 months ago
5.0.1
7 months ago
5.0.0
8 months ago
4.0.0
9 months ago
3.0.0
11 months ago
2.3.0
2 years ago
2.2.2
3 years ago
2.2.1
3 years ago
2.2.0
4 years ago
2.1.1
4 years ago
2.1.0
4 years ago
2.0.5
4 years ago
2.0.4
4 years ago
2.0.3
4 years ago
2.0.2
4 years ago
2.0.1
4 years ago
2.0.0
4 years ago
1.0.10
4 years ago
1.0.9
4 years ago
1.0.8
4 years ago
1.0.7
4 years ago
1.0.6
4 years ago
1.0.2
5 years ago
1.0.1
5 years ago
1.0.4
5 years ago
1.0.3
5 years ago
1.0.0
5 years ago