# @body/stream

> Gives a stream of an incoming http request, optionally with content decoded in respect to the `Content-Encoding` header.

Latest version **0.1.2** (published 2022-09-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install @body/stream
pnpm add @body/stream
yarn add @body/stream
bun add @body/stream
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2022-09-21 |
| First published | 2017-09-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=4 |
| Dependencies | 1 |
| Unpacked size | 4.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | linusu |

## Links

- npm: https://www.npmjs.com/package/@body/stream
- Repository: https://github.com/node-body/stream
- Homepage: https://github.com/node-body/stream#readme
- Issues: https://github.com/node-body/stream/issues
- npm.io page: https://npm.io/package/@body/stream

## Dependencies (1)

- [http-errors](https://npm.io/package/http-errors.md) ^2.0.0

## Recent versions

- 0.1.2 (latest) — 2022-09-21
- 0.1.1 — 2020-05-28
- 0.1.0 — 2017-09-30

## README

# Stream body parser

Gives a stream of an incoming http request, optionally with content decoded in respect to the `Content-Encoding` header.

## Installation

```sh
npm install --save @body/stream
```

## Usage

```js
const getBodyStream = require('@body/stream')

// ...

app.post('/v1/users', (req, res, next) => {
  const body = getBodyStream(req)

  body.pipe(/* ... */)
})

// ...
```

## API

### `getBodyStream(req: Request, options?: Options): ReadableStream`

Read the body of the incoming request `req`. Returns a readable stream of the data.

If the body isn't encoded, the incoming request `req` will be returned as is.

#### Options

##### `inflate` (boolean)

When set to `true`, then bodies with a `deflate` or `gzip` content-encoding will be inflated.

Defaults to `false`.

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