# @types/koa-bodyparser

> TypeScript definitions for koa-bodyparser

Latest version **4.3.13** (published 2025-10-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/koa-bodyparser
pnpm add @types/koa-bodyparser
yarn add @types/koa-bodyparser
bun add @types/koa-bodyparser
```

## Health

**Score 65/100 (B)** — status: stable.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 4.3.13 |
| Published | 2025-10-24 |
| First published | 2016-05-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 7.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51441 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/koa-bodyparser
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/koa-bodyparser
- npm.io page: https://npm.io/package/@types/koa-bodyparser

## Dependencies (1)

- [@types/koa](https://npm.io/package/@types/koa.md) *

## Recent versions

- 4.3.13 (latest) — 2025-10-24
- 4.3.12 (ts4.5) — 2023-11-07
- 4.3.10 (ts4.3) — 2022-11-04
- 4.3.7 (ts4.0) — 2022-03-21
- 4.3.5 (ts3.8) — 2021-12-24
- 4.3.4 (ts3.7) — 2021-10-31
- 4.3.3 (ts3.6) — 2021-08-05
- 4.3.0 (ts2.8) — 2019-05-24
- 3.0.25 (ts2.0) — 2017-09-11
- 4.3.11 — 2023-10-18
- 4.3.9 — 2022-10-28
- 4.3.8 — 2022-09-08
- 4.3.6 — 2022-03-04
- 4.3.2 — 2021-07-06
- 4.3.1 — 2021-06-05
- … 23 more at https://npm.io/package/@types/koa-bodyparser/versions

## README

# Installation
> `npm install --save @types/koa-bodyparser`

# Summary
This package contains type definitions for koa-bodyparser (https://github.com/koajs/body-parser).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/koa-bodyparser.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/koa-bodyparser/index.d.ts)
````ts
/* =================== USAGE ===================

    import bodyParser = require("koa-bodyparser");
    var Koa = require('koa');

    var app = new Koa();
    app.use(bodyParser());

 =============================================== */

import Koa = require("koa");

declare module "koa" {
    interface Request {
        body?: unknown;
        rawBody: string;
    }
}

declare function bodyParser(opts?: bodyParser.Options): Koa.Middleware;

declare namespace bodyParser {
    interface Options {
        /**
         *  parser will only parse when request type hits enableTypes, default is ['json', 'form'].
         */
        enableTypes?: string[] | undefined;

        /**
         * requested encoding. Default is utf-8 by co-body
         */
        encoding?: string | undefined;

        /**
         * limit of the urlencoded body. If the body ends up being larger than this limit
         * a 413 error code is returned. Default is 56kb
         */
        formLimit?: string | undefined;

        /**
         * limit of the json body. Default is 1mb
         */
        jsonLimit?: string | undefined;

        /**
         * limit of the text body. Default is 1mb.
         */
        textLimit?: string | undefined;

        /**
         * limit of the xml body. Default is 1mb.
         */
        xmlLimit?: string | undefined;

        /**
         * when set to true, JSON parser will only accept arrays and objects. Default is true
         */
        strict?: boolean | undefined;

        /**
         * custom json request detect function. Default is null
         */
        detectJSON?: ((ctx: Koa.Context) => boolean) | undefined;

        /**
         * support extend types
         */
        extendTypes?: {
            json?: string[] | string | undefined;
            form?: string[] | string | undefined;
            text?: string[] | string | undefined;
        } | undefined;

        /**
         * support custom error handle
         */
        onerror?: ((err: Error, ctx: Koa.Context) => void) | undefined;
    }
}

export = bodyParser;

````

### Additional Details
 * Last updated: Fri, 24 Oct 2025 04:02:41 GMT
 * Dependencies: [@types/koa](https://npmjs.com/package/@types/koa)

# Credits
These definitions were written by [Jerry Chin](https://github.com/hellopao), [Hiroshi Ioka](https://github.com/hirochachacha), [Alexi Maschas](https://github.com/amaschas), and [Pirasis Leelatanon](https://github.com/1pete).

---
_Source: https://npm.io/package/@types/koa-bodyparser · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
