milliparsec

tiniest body parser in the universe

MIT 29 个版本
安装
npm install milliparsec
yarn add milliparsec
pnpm add milliparsec
bun add milliparsec
README





Version Coverage Github actions Downloads


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
  • ⚡ ~15% faster than body-parser, ~4x 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.1.1 2026-02-09
5.1.0 2025-09-12
5.0.2 2025-02-22
5.0.1 2024-11-23
5.0.0 2024-10-03
4.0.0 2024-09-11
3.0.0 2024-07-03
2.3.0 2023-05-04
2.2.2 2022-05-30
2.2.1 2022-01-27
2.2.0 2021-06-27
2.1.1 2021-06-25
2.1.0 2021-06-25
2.0.5 2021-05-16
2.0.4 2021-04-25
2.0.3 2021-04-08
2.0.2 2021-03-26
2.0.1 2021-03-26
2.0.0 2021-02-09
1.0.10 2021-01-13
1.0.9 2021-01-13
1.0.8 2021-01-13
1.0.7 2021-01-13
1.0.6 2021-01-13
1.0.4 2020-10-07
1.0.3 2020-10-07
1.0.2 2020-10-07
1.0.1 2020-10-07
1.0.0 2020-10-03